public static Com.DataPack.DataRsp <string> FuncEditSave(List <string> arr)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            string oldFuncCode = "";

            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "你现在登录已过期,请重新登录!";
            }
            else
            {
                try
                {
                    SchSystem.BLL.ServFunc   sfcBll   = new SchSystem.BLL.ServFunc();
                    SchSystem.Model.ServFunc sfcModel = new SchSystem.Model.ServFunc();
                    foreach (string str in arr)
                    {
                        string[] strarr = str.Split('#');
                        if (strarr[0] == "autoid")
                        {
                            sfcModel.AutoId = int.Parse(strarr[1]);
                        }
                        else if (strarr[0] == "businesstype")
                        {
                            sfcModel.TypeCode = strarr[1].Trim();
                        }
                        else if (strarr[0] == "businesscode")
                        {
                            sfcModel.FuncCode = strarr[1].Trim();
                        }
                        else if (strarr[0] == "oldbusinesscode")
                        {
                            oldFuncCode = strarr[1].Trim();
                        }
                        else if (strarr[0] == "funcname")
                        {
                            sfcModel.FuncName = strarr[1].Trim();
                        }
                        else if (strarr[0] == "userange")
                        {
                            sfcModel.FuncRange = strarr[1].Trim();
                        }
                        else if (strarr[0] == "addsetinfo")
                        {
                            sfcModel.FuncSet = strarr[1].Trim();
                        }
                        else if (strarr[0] == "businessdesc")
                        {
                            sfcModel.FuncDes = strarr[1].Trim();
                        }
                        else if (strarr[0] == "tagsbusplatfrom")
                        {
                            sfcModel.FuncSyss = strarr[1].Trim();
                        }
                        else if (strarr[0] == "note")
                        {
                            sfcModel.FuncNote = strarr[1].Trim();
                        }
                    }
                    if (sfcModel.TypeCode == "" || sfcModel.FuncCode == "" || sfcModel.FuncName == "" || sfcModel.FuncRange == "" || sfcModel.FuncSet == "" || sfcModel.FuncSyss == "")
                    {
                        rsp.code = "error";
                        rsp.msg  = "操作失败!不允许输入空格";
                    }
                    else
                    {
                        bool resbool = false;
                        if (sfcModel.FuncCode != oldFuncCode)
                        {
                            resbool = sfcBll.Exists(sfcModel.FuncCode);
                        }
                        if (resbool == false)
                        {
                            bool result = sfcBll.Update(sfcModel);
                            if (result)
                            {
                                SchSystem.BLL.ServFuncExt   sfeBll   = new SchSystem.BLL.ServFuncExt();
                                SchSystem.Model.ServFuncExt sfeModel = new SchSystem.Model.ServFuncExt();
                                sfeBll.Delete(sfcModel.AutoId);
                                string   FuncSet       = sfcModel.FuncSet;
                                string[] FuncSetRecArr = FuncSet.Split('|');//英文半角“|”
                                for (int i = 0; i < FuncSetRecArr.Length; i++)
                                {
                                    string[] FuncSetItemArr = FuncSetRecArr[i].Split('!');//英文半角“!”
                                    sfeModel.FuncId    = sfcModel.AutoId;
                                    sfeModel.NapeCode  = FuncSetItemArr[0];
                                    sfeModel.NapeCodes = FuncSetItemArr[1];
                                    sfeModel.NapeC     = int.Parse(FuncSetItemArr[2]);
                                    sfeBll.Add(sfeModel);
                                }
                                rsp.code = "success";
                                rsp.msg  = "操作成功";
                            }
                            else
                            {
                                rsp.code = "error";
                                rsp.msg  = "操作失败";
                            }
                        }
                        else
                        {
                            rsp.code = "codeRepeat";
                            rsp.msg  = "功能代码不允许重复";
                        }
                    }
                }
                catch (Exception ex)
                {
                    rsp.code = "excepError";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }
 public static Com.DataPack.DataRsp <string> FuncAddSave(List <string> arr)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "你现在登录已过期,请重新登录!";
     }
     else
     {
         try
         {
             SchSystem.BLL.ServFunc   sfcBll   = new SchSystem.BLL.ServFunc();
             SchSystem.Model.ServFunc sfcModel = new SchSystem.Model.ServFunc();
             foreach (string str in arr)
             {
                 string[] strarr = str.Split('#');
                 if (strarr[0] == "businesstype")
                 {
                     sfcModel.TypeCode = strarr[1].Trim();
                 }
                 else if (strarr[0] == "businesscode")
                 {
                     sfcModel.FuncCode = strarr[1].Trim();
                 }
                 else if (strarr[0] == "funcname")
                 {
                     sfcModel.FuncName = strarr[1].Trim();
                 }
                 else if (strarr[0] == "userange")
                 {
                     sfcModel.FuncRange = strarr[1].Trim();
                 }
                 else if (strarr[0] == "addsetinfo")
                 {
                     sfcModel.FuncSet = strarr[1].Trim();
                 }
                 else if (strarr[0] == "businessdesc")
                 {
                     sfcModel.FuncDes = strarr[1].Trim();
                 }
                 else if (strarr[0] == "tagsbusplatfrom")
                 {
                     sfcModel.FuncSyss = strarr[1].Trim();
                 }
                 else if (strarr[0] == "note")
                 {
                     sfcModel.FuncNote = strarr[1].Trim();
                 }
             }
             if (sfcModel.TypeCode == "" || sfcModel.FuncCode == "" || sfcModel.FuncName == "" || sfcModel.FuncRange == "" || sfcModel.FuncSet == "" || sfcModel.FuncSyss == "")
             {
                 rsp.code = "error";
                 rsp.msg  = "操作失败!不允许输入空格";
             }
             else
             {
                 bool resbool = sfcBll.Exists(sfcModel.FuncCode);
                 if (!resbool)
                 {
                     int result = sfcBll.Add(sfcModel);
                     if (result > 0)
                     {
                         string    FuncSet       = sfcModel.FuncSet;
                         string[]  FuncSetRecArr = FuncSet.Split('|');//英文半角“|”
                         DataTable dt            = new DataTable();
                         dt.Columns.Add("FuncId");
                         dt.Columns.Add("NapeCode");
                         dt.Columns.Add("NapeCodes");
                         dt.Columns.Add("NapeC");
                         SchSystem.BLL.ServFuncExt sfeBll = new SchSystem.BLL.ServFuncExt();
                         for (int i = 0; i < FuncSetRecArr.Length; i++)
                         {
                             string[] FuncSetItemArr = FuncSetRecArr[i].Split('!');//英文半角“!”
                             //SchSystem.BLL.ServFuncExt sfeBll = new SchSystem.BLL.ServFuncExt();
                             //SchSystem.Model.ServFuncExt sfeModel = new SchSystem.Model.ServFuncExt();
                             //sfeModel.FuncId = result;
                             //sfeModel.NapeCode = FuncSetItemArr[0];
                             //sfeModel.NapeCodes = FuncSetItemArr[1];
                             //sfeModel.NapeC = int.Parse(FuncSetItemArr[2]);
                             //sfeBll.Add(sfeModel);
                             DataRow dry = dt.NewRow();
                             dry["FuncId"]    = result;
                             dry["NapeCode"]  = Com.Public.SqlEncStr(FuncSetItemArr[0]);
                             dry["NapeCodes"] = Com.Public.SqlEncStr(FuncSetItemArr[1]);
                             dry["NapeC"]     = int.Parse(Com.Public.SqlEncStr(FuncSetItemArr[2]));
                             dt.Rows.Add(dry);
                         }
                         rsp.code = "success";
                         rsp.msg  = sfeBll.ExecuteSqlBulkCopy(dt, "ServFuncExt");
                     }
                     else
                     {
                         rsp.code = "error";
                         rsp.msg  = "操作失败";
                     }
                 }
                 else
                 {
                     rsp.code = "codeRepeat";
                     rsp.msg  = "功能代码不允许重复";
                 }
             }
         }
         catch (Exception ex)
         {
             rsp.code = "excepError";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }