From a2cbc7e236720685b9485b494ae2a642cad81f96 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 11 三月 2024 23:12:06 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/BLL/Xt_UserController.cs |  620 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 620 insertions(+), 0 deletions(-)

diff --git a/WebAPI/Controllers/BLL/Xt_UserController.cs b/WebAPI/Controllers/BLL/Xt_UserController.cs
index 99b3bb0..4c60ad0 100644
--- a/WebAPI/Controllers/BLL/Xt_UserController.cs
+++ b/WebAPI/Controllers/BLL/Xt_UserController.cs
@@ -728,6 +728,316 @@
         }
         #endregion
 
+        #region 鐢ㄦ埛鍏宠仈缁勭粐缁存姢鍒楄〃
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Xt_User/UserRelationOrganizationList")]
+        [HttpGet]
+        public object UserRelationOrganizationList(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationOrganization_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                string sql = "";
+
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    sql = "select * from h_v_Gy_UserOrganizationRelationList_Query order by 鐢ㄦ埛浠g爜 asc,缁勭粐浠g爜 asc";
+                    ds = oCN.RunProcReturn(sql, "h_v_Gy_UserOrganizationRelationList_Query");
+                }
+                else
+                {
+                    sql = "select * from h_v_Gy_UserOrganizationRelationList_Query where 1=1 ";
+                    sql = sql + sWhere + " order by 鐢ㄦ埛浠g爜 asc,缁勭粐浠g爜 asc";
+                    ds = oCN.RunProcReturn(sql, "h_v_Gy_UserOrganizationRelationList_Query");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+        #region 鐢ㄦ埛鍏宠仈缁勭粐缁存姢 鍒犻櫎
+        /// <summary>
+        ///鍙傛暟锛歴tring HInterID銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Xt_User/UserRelationOrganizationlist_Drop")]
+        [HttpGet]
+        public object UserRelationOrganizationlist_Drop(string HInterID, string user)
+        {
+            try
+            {
+                string s = "";
+
+                //鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationOrganization_Drop", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                if (HInterID == null || HInterID.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                string sql = "delete from Gy_UserORGRelation where HItemID = " + HInterID;
+                oCN.RunProc(sql);
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+        #region 鐢ㄦ埛鍏宠仈缁勭粐缁存姢 缂栬緫鍒濆鍖�
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Xt_User/UserRelationOrganizationList_EditInit")]
+        [HttpGet]
+        public object UserRelationOrganizationList_EditInit(int HItemID, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationOrganization_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                string sql = "select * from h_v_Gy_UserOrganizationRelationList_Query where HItemID = " + HItemID;
+                ds = oCN.RunProcReturn(sql, "h_v_Gy_UserOrganizationRelationList_Query");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+        #region 鐢ㄦ埛鍏宠仈缁勭粐缁存姢 淇濆瓨
+        [Route("Xt_User/UserRelationOrganizationList_Save")]
+        [HttpPost]
+        public object UserRelationOrganizationList_Save([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { "&鍜�" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string user = sArray[1].ToString();
+            string saveType = sArray[2].ToString();
+            try
+            {
+                //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationOrganization_Edit", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2);
+                List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
+
+                foreach (JObject item in Excel)
+                {
+                    Dictionary<string, string> dic = new Dictionary<string, string>();
+                    foreach (var itm in item.Properties())
+                    {
+                        dic.Add(itm.Name, itm.Value.ToString());
+                    }
+                    list.Add(dic);
+                }
+
+                if (saveType == "1")
+                {
+                    oCN.BeginTran();
+                    string err = "";
+                    int i = 1;
+                    string sql = "";
+                    foreach (Dictionary<string, string> item in list)
+                    {
+                        string HItemID = item["HItemID"].ToString();        //
+                        string HUserID = item["HUserID"].ToString();        //鐢ㄦ埛浠g爜
+                        string HUserName = item["HUserName"].ToString();    //鐢ㄦ埛鍚嶇О
+                        string HOrgID = item["HOrgID"].ToString();          //缁勭粐鍐呯爜
+                        string HOrgNumber = item["HOrgNumber"].ToString();  //缁勭粐浠g爜
+                        string HOrgName = item["HOrgName"].ToString();      //缁勭粐鍚嶇О
+
+
+                        sql = "select * from Gy_UserORGRelation where HUserID = '" + HUserID + "' and HOrgID = " + HOrgID;
+                        ds = oCN.RunProcReturn(sql, "Gy_UserORGRelation");
+                        if (ds.Tables[0].Rows.Count == 0)
+                        {
+                            sql = "insert into Gy_UserORGRelation(HUserID,HOrgID)" +
+                                "values(" +
+                                "'" + HUserID + "'" +
+                                "," + HOrgID + "" +
+                                ")";
+                            oCN.RunProc(sql);
+                        }
+                        else
+                        {
+                            err += "绗�" + i + "琛岋細鐢ㄦ埛銆�" + HUserName + "銆戝凡缁忓叧鑱旂粍缁囥��" + HOrgName + "銆�";
+                        }
+                        i++;
+                    }
+                    //鍒ゆ柇鏄惁瀛樺湪閿欒
+                    if (err.Length > 0)
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛�" + err;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else if (saveType == "3")
+                {
+                    oCN.BeginTran();
+                    string err = "";
+                    int i = 1;
+                    string sql = "";
+                    foreach (Dictionary<string, string> item in list)
+                    {
+                        string HItemID = item["HItemID"].ToString();        //
+                        string HUserID = item["HUserID"].ToString();        //鐢ㄦ埛浠g爜
+                        string HUserName = item["HUserName"].ToString();    //鐢ㄦ埛鍚嶇О
+                        string HOrgID = item["HOrgID"].ToString();          //缁勭粐鍐呯爜
+                        string HOrgNumber = item["HOrgNumber"].ToString();  //缁勭粐浠g爜
+                        string HOrgName = item["HOrgName"].ToString();      //缁勭粐鍚嶇О
+
+                        sql = "select * from Gy_UserORGRelation where HItemID = " + HItemID;
+                        ds = oCN.RunProcReturn(sql, "Gy_UserORGRelation");
+                        if (ds.Tables[0].Rows.Count > 0)
+                        {
+                            sql = "select * from Gy_UserORGRelation where HUserID = '" + HUserID + "' and HOrgID = " + HOrgID + " and HItemID <> " + HItemID;
+                            ds = oCN.RunProcReturn(sql, "Gy_UserORGRelation");
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                sql = "update Gy_UserORGRelation set " +
+                                      "HUserID = '" + HUserID + "' " +
+                                      ",HOrgID = " + HOrgID + " " +
+                                      "where HItemID = " + HItemID;
+                                oCN.RunProc(sql);
+                            }
+                            else
+                            {
+                                err += "绗�" + i + "琛岋細鐢ㄦ埛銆�" + HUserName + "銆戝凡缁忓叧鑱旂粍缁囥��" + HOrgName + "銆�";
+                            }
+                        }
+                        else
+                        {
+                            err += "绗�" + i + "琛岋細璁板綍涓嶅瓨鍦�!";
+                        }
+                        i++;
+                    }
+                    //鍒ゆ柇鏄惁瀛樺湪閿欒
+                    if (err.Length > 0)
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛�" + err;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛!";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                LogService.Write(e);
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region  鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶄粨搴撳垪琛�
         [Route("Xt_User/UserStocklistPlaylist")]
         [HttpGet]
@@ -1881,6 +2191,316 @@
         }
         #endregion
 
+        #region 鐢ㄦ埛鍏宠仈鑱屽憳缁存姢鍒楄〃
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Xt_User/UserRelationEmployeelist")]
+        [HttpGet]
+        public object UserRelationEmployeelist(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationEmployee_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                string sql = "";
+
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    sql = "select * from h_v_Gy_UserEmployeeRelationList_Query order by 鐢ㄦ埛浠g爜 asc,鑱屽憳浠g爜 asc";
+                    ds = oCN.RunProcReturn(sql, "h_v_Gy_UserEmployeeRelationList_Query");
+                }
+                else
+                {
+                    sql = "select * from h_v_Gy_UserEmployeeRelationList_Query where 1=1 ";
+                    sql = sql + sWhere + " order by 鐢ㄦ埛浠g爜 asc,鑱屽憳浠g爜 asc";
+                    ds = oCN.RunProcReturn(sql, "h_v_Gy_UserEmployeeRelationList_Query");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+        #region 鐢ㄦ埛鍏宠仈鑱屽憳缁存姢 鍒犻櫎
+        /// <summary>
+        ///鍙傛暟锛歴tring HInterID銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Xt_User/UserRelationEmployeelist_Drop")]
+        [HttpGet]
+        public object UserRelationEmployeelist_Drop(string HInterID, string user)
+        {
+            try
+            {
+                string s = "";
+
+                //鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationEmployee_Drop", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                if (HInterID == null || HInterID.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                string sql = "delete from Gy_UserEmployeeRelation where HItemID = " + HInterID;
+                oCN.RunProc(sql);
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+        #region 鐢ㄦ埛鍏宠仈鑱屽憳缁存姢 缂栬緫鍒濆鍖�
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Xt_User/UserRelationEmployeelist_EditInit")]
+        [HttpGet]
+        public object UserRelationEmployeelist_EditInit(int HItemID, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationEmployee_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                string sql = "select * from h_v_Gy_UserEmployeeRelationList_Query where HItemID = " + HItemID;
+                ds = oCN.RunProcReturn(sql, "h_v_Gy_UserEmployeeRelationList_Query");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+        #region 鐢ㄦ埛鍏宠仈鑱屽憳缁存姢 淇濆瓨
+        [Route("Xt_User/UserRelationEmployeelist_Save")]
+        [HttpPost]
+        public object UserRelationEmployeelist_Save([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { "&鍜�" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string user = sArray[1].ToString();
+            string saveType = sArray[2].ToString();
+            try
+            {
+                //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationEmployee_Edit", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2);
+                List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
+
+                foreach (JObject item in Excel)
+                {
+                    Dictionary<string, string> dic = new Dictionary<string, string>();
+                    foreach (var itm in item.Properties())
+                    {
+                        dic.Add(itm.Name, itm.Value.ToString());
+                    }
+                    list.Add(dic);
+                }
+
+                if (saveType == "1")
+                {
+                    oCN.BeginTran();
+                    string err = "";
+                    int i = 1;
+                    string sql = "";
+                    foreach (Dictionary<string, string> item in list)
+                    {
+                        string HItemID = item["HItemID"].ToString();        //
+                        string HUserID = item["HUserID"].ToString();        //鐢ㄦ埛浠g爜
+                        string HUserName = item["HUserName"].ToString();    //鐢ㄦ埛鍚嶇О
+                        string HEmpID = item["HEmpID"].ToString();          //瀹㈡埛鍐呯爜
+                        string HEmpNumber = item["HEmpNumber"].ToString();  //瀹㈡埛浠g爜
+                        string HEmpName = item["HEmpName"].ToString();      //瀹㈡埛鍚嶇О
+
+
+                        sql = "select * from Gy_UserEmployeeRelation where HUserID = '" + HUserID + "' and HEmployeeID = " + HEmpID;
+                        ds = oCN.RunProcReturn(sql, "Gy_UserEmployeeRelation");
+                        if (ds.Tables[0].Rows.Count == 0)
+                        {
+                            sql = "insert into Gy_UserEmployeeRelation(HUserID,HEmployeeID)" +
+                                "values(" +
+                                "'" + HUserID + "'" +
+                                "," + HEmpID + "" +
+                                ")";
+                            oCN.RunProc(sql);
+                        }
+                        else
+                        {
+                            err += "绗�" + i + "琛岋細鐢ㄦ埛銆�" + HUserName + "銆戝凡缁忓叧鑱旇亴鍛樸��" + HEmpName + "銆�";
+                        }
+                        i++;
+                    }
+                    //鍒ゆ柇鏄惁瀛樺湪閿欒
+                    if (err.Length > 0)
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛�" + err;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else if (saveType == "3")
+                {
+                    oCN.BeginTran();
+                    string err = "";
+                    int i = 1;
+                    string sql = "";
+                    foreach (Dictionary<string, string> item in list)
+                    {
+                        string HItemID = item["HItemID"].ToString();        //
+                        string HUserID = item["HUserID"].ToString();        //鐢ㄦ埛浠g爜
+                        string HUserName = item["HUserName"].ToString();    //鐢ㄦ埛鍚嶇О
+                        string HEmpID = item["HEmpID"].ToString();          //鑱屽憳鍐呯爜
+                        string HEmpNumber = item["HEmpNumber"].ToString();  //鑱屽憳浠g爜
+                        string HEmpName = item["HEmpName"].ToString();      //鑱屽憳鍚嶇О
+
+                        sql = "select * from Gy_UserEmployeeRelation where HItemID = " + HItemID;
+                        ds = oCN.RunProcReturn(sql, "Gy_UserEmployeeRelation");
+                        if (ds.Tables[0].Rows.Count > 0)
+                        {
+                            sql = "select * from Gy_UserEmployeeRelation where HUserID = '" + HUserID + "' and HEmployeeID = " + HEmpID + " and HItemID <> " + HItemID;
+                            ds = oCN.RunProcReturn(sql, "Gy_UserEmployeeRelation");
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                sql = "update Gy_UserEmployeeRelation set " +
+                                      "HUserID = '" + HUserID + "' " +
+                                      ",HEmployeeID = " + HEmpID + " " +
+                                      "where HItemID = " + HItemID;
+                                oCN.RunProc(sql);
+                            }
+                            else
+                            {
+                                err += "绗�" + i + "琛岋細鐢ㄦ埛銆�" + HUserName + "銆戝凡缁忓叧鑱旇亴鍛樸��" + HEmpName + "銆�";
+                            }
+                        }
+                        else
+                        {
+                            err += "绗�" + i + "琛岋細璁板綍涓嶅瓨鍦�!";
+                        }
+                        i++;
+                    }
+                    //鍒ゆ柇鏄惁瀛樺湪閿欒
+                    if (err.Length > 0)
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛�" + err;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛!";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                LogService.Write(e);
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region  鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶇敤鎴峰垪琛�
         [Route("Xt_User/UserPlaylist")]
         [HttpGet]

--
Gitblit v1.9.1