Ejemplo n.º 1
0
        /// <summary>
        /// 保存用户组资料数据
        /// </summary>
        /// <returns>1:保存成功;0:保存失败</returns>
        public override int SaveData()
        {
            string TabNam = "t_ADMM_GrpMst";
            string PriKey = "fGrpCode";

            //string FrmNam = "DiousEPortal.FrmUserGroup";
            FocColNam = "分组代号";
            if (BtnName == BtnNam.Add || BtnName == BtnNam.Copy)
            {
                FocColVal = Txt_Grpcode.Text;
            }
            else
            {
                //初始化FocColVal,方便后续新增数据定位行用
                FocColVal = (string)((IDictionary <string, object>)((ExpandoObject)View_Common2.GetFocusedRow()))[FocColNam];
            }

            //初始化主键控件名称
            string ContrNam = KeyContrNam[0];

            try
            {
                string SQL = "";
                List <DTSerializer <string, object> > List_DTObj  = new List <DTSerializer <string, object> >();
                List <DTSerializer <string, object> > List_DTObj1 = new List <DTSerializer <string, object> >();
                List <ExpandoObject> List_EObj;
                //开始SQL事务
                ComClient.BeginTransaction();
                //只有不重复才往下执行
                if (BtnName == BtnNam.Add && ComClient.RepeatCheck(TabNam, PriKey, Txt_Grpcode.Text) == 0)
                {
                    //1.查询哪些表需要更新(输出表名、面板名、窗体实例名)
                    List <ExpandoObject> List_UpTab = LoadData(ComClient.GetTabByFrmNam(FrmNam));

                    foreach (dynamic UpTab in List_UpTab)
                    {
                        //2.根据表名和窗体实例名查询出更新表需要的关键信息
                        List_EObj = LoadData(ComClient.GetTabStrc(UpTab.FTblNm, FrmNam, OperType.AddSave, "", UpTab.FPanelNam, "", ""));
                        //获取执行SQL
                        foreach (ExpandoObject EObj in List_EObj)
                        {
                            var IDObj = (IDictionary <string, object>)EObj;
                            SQL = (string)IDObj["SQL"];
                        }

                        List <List <ExpandoObject> > List_PanelObjs = new List <List <ExpandoObject> >();
                        //根据面板名称读取该面板内所有相关字段信息
                        List <ExpandoObject> List_Panel4EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel4", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel4EObj);
                        List <ExpandoObject> List_Panel3EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel3", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel3EObj);
                        List <ExpandoObject> List_Panel7EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel7", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel7EObj);
                        List <ExpandoObject> List_Panel8EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel8", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel8EObj);
                        List <ExpandoObject> List_Panel9EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel9", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel9EObj);
                        List <ExpandoObject> List_Panel10EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel10", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel10EObj);
                        List <ExpandoObject> List_Panel11EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel11", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel11EObj);
                        List <ExpandoObject> List_Panel12EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel12", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel12EObj);
                        //用于存储该表在所有面板内的字段值
                        DTSerializer <string, object> DTObj = new DTSerializer <string, object>();
                        foreach (List <ExpandoObject> List_PanelObj in List_PanelObjs)
                        {
                            if (List_PanelObj.Count != 0)
                            {
                                var Query = from Obj in List_PanelObj
                                            where EObjToIDObj(Obj)["FPanelNam"].ToString() == "Panel3"
                                            select Obj;
                                //Panel3面板中是网格控件,则按照以下逻辑单独处理
                                if (Query.Count <ExpandoObject>() > 0)
                                {
                                    //遍历View_Common1数据源获取每个字段的值
                                    foreach (ExpandoObject EObj3 in (BindingList <ExpandoObject>)View_Common1.DataSource)
                                    {
                                        IDictionary <string, object>  IDObj  = (IDictionary <string, object>)EObj3;
                                        DTSerializer <string, object> DTObj1 = new DTSerializer <string, object>();
                                        foreach (string Key in IDObj.Keys)
                                        {
                                            //利用LinQ将中文字段名转换成英文字段名
                                            var Query1 = from Obj in List_PanelObj
                                                         where EObjToIDObj(Obj)["FRemark"].ToString() == Key
                                                         select EObjToIDObj(Obj)["FColNm"].ToString();

                                            string Key1 = "";
                                            foreach (var key in Query1)
                                            {
                                                Key1 = key.ToString();
                                            }
                                            if (Key1 != "")
                                            {
                                                if (Key1 == PriKey)
                                                {
                                                    DTObj1.Add(Key1, Panel4.Controls[ContrNam].Text);
                                                }
                                                else
                                                {
                                                    DTObj1.Add(Key1, IDObj[Key].ToString());
                                                }
                                            }
                                        }
                                        //3.循环完Panel3面板的每一行字段后,生成更新对象列表
                                        List_DTObj1.Add(DTObj1);
                                    }
                                    //4.服务端根据接收到的对象列表更新数据库
                                    //ComClient.SaveData(Serializer.SerializeDTToXml<List<DTSerializer<string, object>>>(List_DTObj1), SQL, OperType.AddSave);
                                    ComClient.SaveData1(Serializer.SerializeDTToXml <List <DTSerializer <string, object> > >(List_DTObj1), SQL);
                                }
                                //非Panel3面板,则按照以下逻辑单独处理
                                else
                                {
                                    //根据面板内的字段信息自动生成更新对象列表
                                    foreach (dynamic EObj in List_PanelObj)
                                    {
                                        //如果该字段绑定了指定控件,则按照控件指定值更新
                                        if (EObj.FContrNam != "")
                                        {
                                            if (EObj.FColNm == "fCFlag")
                                            {
                                                DTObj.Add(EObj.FColNm, Panel4.Controls[EObj.FContrNam].Text == "已审核" ? 1 : 0);
                                            }
                                            else if (EObj.FColNm == "fIfUse")
                                            {
                                                DTObj.Add(EObj.FColNm, Panel4.Controls[EObj.FContrNam].Text == "已启用" ? 1 : 0);
                                            }
                                            else
                                            {
                                                if (EObj.FPanelNam == "Panel4")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel4.Controls[EObj.FContrNam].Text);
                                                }

                                                else if (EObj.FPanelNam == "Panel7")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel7.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel8")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel8.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel9")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel9.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel10")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel10.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel11")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel11.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel12")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel12.Controls[EObj.FContrNam].Text);
                                                }
                                            }
                                        }
                                        //如果该字段没有绑定任何控件,则按照默认值更新
                                        else
                                        {
                                            //如果该字段的默认数据类型是DateTime,则默认值是当天
                                            if (EObj.FColNm == "fCDate")
                                            {
                                                DTObj.Add(EObj.FColNm, DateTime.Now.ToString());
                                            }
                                            else if (EObj.FColNm == "fCreatorID")
                                            {
                                                DTObj.Add(EObj.FColNm, CurUsrID);
                                            }
                                            else if (EObj.FColNm == "fCreator")
                                            {
                                                DTObj.Add(EObj.FColNm, CurUsrName);
                                            }
                                            else
                                            {
                                                DTObj.Add(EObj.FColNm, EObj.FDefValue);
                                            }
                                        }
                                    }
                                    //3.循环完所有面板的字段后,生成更新对象列表
                                    List_DTObj.Add(DTObj);
                                    //4.服务端根据接收到的对象列表更新数据库
                                    //ComClient.SaveData(Serializer.SerializeDTToXml<List<DTSerializer<string, object>>>(List_DTObj), SQL, OperType.AddSave);
                                    ComClient.SaveData1(Serializer.SerializeDTToXml <List <DTSerializer <string, object> > >(List_DTObj), SQL);
                                }
                            }
                        }
                    }
                    //提交事务
                    ComClient.CommitTransaction();
                    BtnName = BtnNam.Null;
                    //重新刷新网格数据
                    Grip_Common2.DataSource = LoadData(UsrGroupClient.GetUsrGrpsToChCol("#Tmp_" + CurUsrID + "_" + DateTime.Now.Second.ToString(), "0", ""));
                    return(1);
                }
                else if (BtnName == BtnNam.Copy && ComClient.RepeatCheck(TabNam, PriKey, Txt_Grpcode.Text) == 0)
                {
                    //1.查询哪些表需要更新(输出表名、面板名、窗体实例名)
                    List <ExpandoObject> List_UpTab = LoadData(ComClient.GetTabByFrmNam(FrmNam));

                    foreach (dynamic UpTab in List_UpTab)
                    {
                        //2.根据表名和窗体实例名查询出更新表需要的关键信息
                        List_EObj = LoadData(ComClient.GetTabStrc(UpTab.FTblNm, FrmNam, OperType.AddSave, "", UpTab.FPanelNam, "", ""));
                        //获取执行SQL
                        foreach (ExpandoObject EObj in List_EObj)
                        {
                            var IDObj = (IDictionary <string, object>)EObj;
                            SQL = (string)IDObj["SQL"];
                        }

                        List <List <ExpandoObject> > List_PanelObjs = new List <List <ExpandoObject> >();
                        //根据面板名称读取该面板内所有相关字段信息
                        List <ExpandoObject> List_Panel4EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel4", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel4EObj);
                        List <ExpandoObject> List_Panel3EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel3", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel3EObj);
                        List <ExpandoObject> List_Panel7EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel7", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel7EObj);
                        List <ExpandoObject> List_Panel8EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel8", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel8EObj);
                        List <ExpandoObject> List_Panel9EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel9", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel9EObj);
                        List <ExpandoObject> List_Panel10EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel10", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel10EObj);
                        List <ExpandoObject> List_Panel11EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel11", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel11EObj);
                        List <ExpandoObject> List_Panel12EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel12", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel12EObj);
                        //用于存储该表在所有面板内的字段值
                        DTSerializer <string, object> DTObj = new DTSerializer <string, object>();
                        foreach (List <ExpandoObject> List_PanelObj in List_PanelObjs)
                        {
                            if (List_PanelObj.Count != 0)
                            {
                                var Query = from Obj in List_PanelObj
                                            where EObjToIDObj(Obj)["FPanelNam"].ToString() == "Panel3"
                                            select Obj;
                                //Panel3面板中是网格控件,则按照以下逻辑单独处理
                                if (Query.Count <ExpandoObject>() > 0)
                                {
                                    //遍历View_Common1数据源获取每个字段的值
                                    foreach (ExpandoObject EObj3 in (BindingList <ExpandoObject>)View_Common1.DataSource)
                                    {
                                        IDictionary <string, object>  IDObj  = (IDictionary <string, object>)EObj3;
                                        DTSerializer <string, object> DTObj1 = new DTSerializer <string, object>();
                                        foreach (string Key in IDObj.Keys)
                                        {
                                            //利用LinQ将中文字段名转换成英文字段名
                                            var Query1 = from Obj in List_PanelObj
                                                         where EObjToIDObj(Obj)["FRemark"].ToString() == Key
                                                         select EObjToIDObj(Obj)["FColNm"].ToString();

                                            string Key1 = "";
                                            foreach (var key in Query1)
                                            {
                                                Key1 = key.ToString();
                                            }
                                            if (Key1 != "")
                                            {
                                                if (Key1 == PriKey)
                                                {
                                                    DTObj1.Add(Key1, Panel4.Controls[ContrNam].Text);
                                                }
                                                else
                                                {
                                                    DTObj1.Add(Key1, IDObj[Key].ToString());
                                                }
                                            }
                                        }
                                        //3.循环完Panel3面板的每一行字段后,生成更新对象列表
                                        List_DTObj1.Add(DTObj1);
                                    }
                                    //4.服务端根据接收到的对象列表更新数据库
                                    //ComClient.SaveData(Serializer.SerializeDTToXml<List<DTSerializer<string, object>>>(List_DTObj1), SQL, OperType.AddSave);
                                    ComClient.SaveData1(Serializer.SerializeDTToXml <List <DTSerializer <string, object> > >(List_DTObj1), SQL);
                                }
                                //非Panel3面板,则按照以下逻辑单独处理
                                else
                                {
                                    //根据面板内的字段信息自动生成更新对象列表
                                    foreach (dynamic EObj in List_PanelObj)
                                    {
                                        //如果该字段绑定了指定控件,则按照控件指定值更新
                                        if (EObj.FContrNam != "")
                                        {
                                            if (EObj.FColNm == "fCFlag")
                                            {
                                                DTObj.Add(EObj.FColNm, Panel4.Controls[EObj.FContrNam].Text == "已审核" ? 1 : 0);
                                            }
                                            else if (EObj.FColNm == "fIfUse")
                                            {
                                                DTObj.Add(EObj.FColNm, Panel4.Controls[EObj.FContrNam].Text == "已启用" ? 1 : 0);
                                            }
                                            else
                                            {
                                                if (EObj.FPanelNam == "Panel4")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel4.Controls[EObj.FContrNam].Text);
                                                }

                                                else if (EObj.FPanelNam == "Panel7")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel7.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel8")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel8.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel9")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel9.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel10")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel10.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel11")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel11.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel12")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel12.Controls[EObj.FContrNam].Text);
                                                }
                                            }
                                        }
                                        //如果该字段没有绑定任何控件,则按照默认值更新
                                        else
                                        {
                                            //如果该字段的默认数据类型是DateTime,则默认值是当天
                                            if (EObj.FColNm == "fCDate")
                                            {
                                                DTObj.Add(EObj.FColNm, DateTime.Now.ToString());
                                            }
                                            //if (EObj.FColNm == "fAppDate")
                                            //{
                                            //    DTObj.Add(EObj.FColNm, DateTime.Now.ToString());
                                            //}
                                            else if (EObj.FColNm == "fCreatorID")
                                            {
                                                DTObj.Add(EObj.FColNm, CurUsrID);
                                            }
                                            else if (EObj.FColNm == "fCreator")
                                            {
                                                DTObj.Add(EObj.FColNm, CurUsrName);
                                            }
                                            else
                                            {
                                                DTObj.Add(EObj.FColNm, EObj.FDefValue);
                                            }
                                        }
                                    }
                                    //3.循环完所有面板的字段后,生成更新对象列表
                                    List_DTObj.Add(DTObj);
                                    //4.服务端根据接收到的对象列表更新数据库
                                    //ComClient.SaveData(Serializer.SerializeDTToXml<List<DTSerializer<string, object>>>(List_DTObj), SQL, OperType.AddSave);
                                    ComClient.SaveData1(Serializer.SerializeDTToXml <List <DTSerializer <string, object> > >(List_DTObj), SQL);
                                    //提交事务
                                    ComClient.CommitTransaction();
                                }
                            }
                        }
                        BtnName = BtnNam.Null;
                        //重新刷新网格数据
                        Grip_Common2.DataSource = LoadData(UsrGroupClient.GetUsrGrpsToChCol("#Tmp_" + CurUsrID + "_" + DateTime.Now.Second.ToString(), "0", ""));
                    }
                    return(1);
                }
                else if (BtnName == BtnNam.Delete)
                {
                    //1.查询哪些表需要更新(输出表名、面板名、窗体实例名)
                    List <ExpandoObject> List_UpTab = LoadData(ComClient.GetTabByFrmNam(FrmNam));
                    //获取当前选择行的数据
                    IDictionary <string, object> IDObj = (IDictionary <string, object>)View_Common2.GetFocusedRow();
                    foreach (dynamic UpTab in List_UpTab)
                    {
                        List_EObj = LoadData(ComClient.GetTabStrc(UpTab.FTblNm, FrmNam, OperType.Delete, PriKey + " ='" + IDObj[ComClient.GetChColByEnCol(TabNam, PriKey)].ToString() + "'", UpTab.FPanelNam, "", ""));
                        //获取执行SQL
                        foreach (ExpandoObject EObj in List_EObj)
                        {
                            var IDObj1 = (IDictionary <string, object>)EObj;
                            SQL = (string)IDObj1["SQL"];
                        }

                        //ComClient.SaveData(Serializer.SerializeDTToXml<List<DTSerializer<string, object>>>(List_DTObj), SQL, OperType.Delete);
                        ComClient.SaveData1("", SQL);
                    }
                    //提交事务
                    ComClient.CommitTransaction();

                    BtnName = BtnNam.Null;
                    //重新刷新网格数据
                    Grip_Common2.DataSource = LoadData(UsrGroupClient.GetUsrGrpsToChCol("#Tmp_" + CurUsrID + "_" + DateTime.Now.Second.ToString(), "0", ""));
                    return(1);
                }
                else if (BtnName == BtnNam.Edit)
                {
                    //1.查询哪些表需要更新(输出表名、面板名、窗体实例名)
                    List <ExpandoObject> List_UpTab = LoadData(ComClient.GetTabByFrmNam(FrmNam));
                    //获取当前选择行的数据
                    IDictionary <string, object> IDObj1 = (IDictionary <string, object>)View_Common2.GetFocusedRow();
                    foreach (dynamic UpTab in List_UpTab)
                    {
                        //判断更新表归属于哪个面板
                        if (UpTab.FPanelNam != "Panel3")
                        {
                            //2.根据表名和窗体实例名查询出更新表需要的关键信息
                            List_EObj = LoadData(ComClient.GetTabStrc(UpTab.FTblNm, FrmNam, OperType.EditSave, PriKey + " ='" + IDObj1[ComClient.GetChColByEnCol(TabNam, PriKey)].ToString() + "'", UpTab.FPanelNam, "", ""));
                            //获取执行SQL
                            foreach (ExpandoObject EObj in List_EObj)
                            {
                                var IDObj = (IDictionary <string, object>)EObj;
                                SQL = (string)IDObj["SQL"];
                            }
                        }
                        else
                        {
                            //2.根据表名和窗体实例名查询出更新表需要的关键信息
                            List_EObj = LoadData(ComClient.GetTabStrc(UpTab.FTblNm, FrmNam, OperType.Delete, PriKey + " ='" + IDObj1[ComClient.GetChColByEnCol(TabNam, PriKey)].ToString() + "'", UpTab.FPanelNam, "", ""));
                            //获取执行SQL
                            foreach (ExpandoObject EObj in List_EObj)
                            {
                                var IDObj = (IDictionary <string, object>)EObj;
                                SQL = (string)IDObj["SQL"];
                            }
                            //先执行删除数据操作
                            //ComClient.SaveData(Serializer.SerializeDTToXml<List<DTSerializer<string, object>>>(List_DTObj1), SQL, OperType.Delete);
                            ComClient.SaveData1("", SQL);
                            //2.根据表名和窗体实例名查询出更新表需要的关键信息
                            List_EObj = LoadData(ComClient.GetTabStrc(UpTab.FTblNm, FrmNam, OperType.AddSave, "", UpTab.FPanelNam, "", ""));
                            //获取执行SQL
                            foreach (ExpandoObject EObj in List_EObj)
                            {
                                var IDObj = (IDictionary <string, object>)EObj;
                                SQL = (string)IDObj["SQL"];
                            }
                        }

                        List <List <ExpandoObject> > List_PanelObjs = new List <List <ExpandoObject> >();
                        //根据面板名称读取该面板内所有相关字段信息
                        List <ExpandoObject> List_Panel4EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel4", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel4EObj);
                        List <ExpandoObject> List_Panel3EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel3", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel3EObj);
                        List <ExpandoObject> List_Panel7EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel7", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel7EObj);
                        List <ExpandoObject> List_Panel8EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel8", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel8EObj);
                        List <ExpandoObject> List_Panel9EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel9", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel9EObj);
                        List <ExpandoObject> List_Panel10EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel10", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel10EObj);
                        List <ExpandoObject> List_Panel11EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel11", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel11EObj);
                        List <ExpandoObject> List_Panel12EObj = Serializer.DeserializeXMLToEObject(ComClient.GetColsByPanelNam("Panel12", FrmNam, UpTab.FTblNm));
                        List_PanelObjs.Add(List_Panel12EObj);
                        //用于存储该表在所有面板内的字段值
                        DTSerializer <string, object> DTObj = new DTSerializer <string, object>();
                        foreach (List <ExpandoObject> List_PanelObj in List_PanelObjs)
                        {
                            if (List_PanelObj.Count != 0)
                            {
                                var Query = from Obj in List_PanelObj
                                            where EObjToIDObj(Obj)["FPanelNam"].ToString() == "Panel3"
                                            select Obj;
                                //Panel3面板中是网格控件,则按照以下逻辑单独处理
                                if (Query.Count <ExpandoObject>() > 0)
                                {
                                    //遍历View_Common1数据源获取每个字段的值
                                    foreach (ExpandoObject EObj3 in (BindingList <ExpandoObject>)View_Common1.DataSource)
                                    {
                                        IDictionary <string, object>  IDObj  = (IDictionary <string, object>)EObj3;
                                        DTSerializer <string, object> DTObj1 = new DTSerializer <string, object>();
                                        foreach (string Key in IDObj.Keys)
                                        {
                                            //利用LinQ将中文字段名转换成英文字段名
                                            var Query1 = from Obj in List_PanelObj
                                                         where EObjToIDObj(Obj)["FRemark"].ToString() == Key
                                                         select EObjToIDObj(Obj)["FColNm"].ToString();

                                            string Key1 = "";
                                            foreach (var key in Query1)
                                            {
                                                Key1 = key.ToString();
                                            }
                                            if (Key1 != "")
                                            {
                                                if (Key1 == PriKey)
                                                {
                                                    DTObj1.Add(Key1, Panel4.Controls[ContrNam].Text);
                                                }
                                                else
                                                {
                                                    DTObj1.Add(Key1, IDObj[Key].ToString());
                                                }
                                            }
                                        }
                                        //3.循环完Panel3面板的每一行字段后,生成更新对象列表
                                        List_DTObj1.Add(DTObj1);
                                    }
                                    //4.服务端根据接收到的对象列表更新数据库
                                    //ComClient.SaveData(Serializer.SerializeDTToXml<List<DTSerializer<string, object>>>(List_DTObj1), SQL, OperType.AddSave);
                                    ComClient.SaveData1(Serializer.SerializeDTToXml <List <DTSerializer <string, object> > >(List_DTObj1), SQL);
                                }
                                //非Panel3面板,则按照以下逻辑单独处理
                                else
                                {
                                    //根据面板内的字段信息自动生成更新对象列表
                                    foreach (dynamic EObj in List_PanelObj)
                                    {
                                        //如果该字段绑定了指定控件,则按照控件指定值更新
                                        if (EObj.FContrNam != "")
                                        {
                                            if (EObj.FColNm == "fCFlag")
                                            {
                                                DTObj.Add(EObj.FColNm, Panel4.Controls[EObj.FContrNam].Text == "已审核" ? 1 : 0);
                                            }
                                            else if (EObj.FColNm == "fIfUse")
                                            {
                                                DTObj.Add(EObj.FColNm, Panel4.Controls[EObj.FContrNam].Text == "已启用" ? 1 : 0);
                                            }
                                            else
                                            {
                                                if (EObj.FPanelNam == "Panel4")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel4.Controls[EObj.FContrNam].Text);
                                                }

                                                else if (EObj.FPanelNam == "Panel7")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel7.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel8")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel8.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel9")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel9.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel10")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel10.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel11")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel11.Controls[EObj.FContrNam].Text);
                                                }
                                                else if (EObj.FPanelNam == "Panel12")
                                                {
                                                    DTObj.Add(EObj.FColNm, Panel12.Controls[EObj.FContrNam].Text);
                                                }
                                            }
                                        }
                                        //如果该字段没有绑定任何控件,则按照默认值更新
                                        else
                                        {
                                            //如果该字段的默认数据类型是DateTime,则默认值是当天
                                            if (EObj.FColNm == "fCDate")
                                            {
                                                DTObj.Add(EObj.FColNm, IDObj1["建立日期"].ToString());
                                            }
                                            else if (EObj.FColNm == "fModiDate")
                                            {
                                                DTObj.Add(EObj.FColNm, DateTime.Now.ToString());
                                            }
                                            else if (EObj.FColNm == "fModifier")
                                            {
                                                DTObj.Add(EObj.FColNm, CurUsrName);
                                            }
                                            else if (EObj.FColNm == "fModifierID")
                                            {
                                                DTObj.Add(EObj.FColNm, CurUsrID);
                                            }
                                            else if (EObj.FColNm == "fCreatorID")
                                            {
                                                DTObj.Add(EObj.FColNm, IDObj1["建立人代号"].ToString());
                                            }
                                            else if (EObj.FColNm == "fCreator")
                                            {
                                                DTObj.Add(EObj.FColNm, IDObj1["建立人姓名"].ToString());
                                            }
                                            else
                                            {
                                                DTObj.Add(EObj.FColNm, EObj.FDefValue);
                                            }
                                        }
                                    }
                                    //3.循环完所有面板的字段后,生成更新对象列表
                                    List_DTObj.Add(DTObj);
                                    //4.服务端根据接收到的对象列表更新数据库
                                    //ComClient.SaveData(Serializer.SerializeDTToXml<List<DTSerializer<string, object>>>(List_DTObj), SQL, OperType.AddSave);
                                    ComClient.SaveData1(Serializer.SerializeDTToXml <List <DTSerializer <string, object> > >(List_DTObj), SQL);
                                    ComClient.CommitTransaction();
                                }
                            }
                        }
                        BtnName = BtnNam.Null;
                        //重新刷新网格数据
                        Grip_Common2.DataSource = LoadData(UsrGroupClient.GetUsrGrpsToChCol("#Tmp_" + CurUsrID + "_" + DateTime.Now.Second.ToString(), "0", ""));
                    }
                    return(1);
                }
                else if (BtnName == BtnNam.Unapprove || BtnName == BtnNam.Approve || BtnName == BtnNam.Disable || BtnName == BtnNam.Enable)
                {
                    //获取当前选择行的数据
                    IDictionary <string, object> IDObj1 = (IDictionary <string, object>)View_Common2.GetFocusedRow();
                    if (BtnName == BtnNam.Unapprove)
                    {
                        //根据表名和窗体实例名查询出更新表需要的关键信息
                        List_EObj = LoadData(ComClient.GetTabStrc(TabNam, FrmNam, OperType.UnApprove, PriKey + " ='" + IDObj1[ComClient.GetChColByEnCol(TabNam, PriKey)].ToString() + "'", "Panel4", CurUsrID, CurUsrName));
                        //获取执行SQL
                        foreach (ExpandoObject EObj in List_EObj)
                        {
                            var IDObj = (IDictionary <string, object>)EObj;
                            SQL = (string)IDObj["SQL"];
                        }
                    }
                    else if (BtnName == BtnNam.Approve)
                    {
                        //根据表名和窗体实例名查询出更新表需要的关键信息
                        List_EObj = LoadData(ComClient.GetTabStrc(TabNam, FrmNam, OperType.Approve, PriKey + " ='" + IDObj1[ComClient.GetChColByEnCol(TabNam, PriKey)].ToString() + "'", "Panel4", CurUsrID, CurUsrName));
                        //获取执行SQL
                        foreach (ExpandoObject EObj in List_EObj)
                        {
                            var IDObj = (IDictionary <string, object>)EObj;
                            SQL = (string)IDObj["SQL"];
                        }
                    }
                    else if (BtnName == BtnNam.Disable)
                    {
                        //根据表名和窗体实例名查询出更新表需要的关键信息
                        List_EObj = LoadData(ComClient.GetTabStrc(TabNam, FrmNam, OperType.Disable, PriKey + " ='" + IDObj1[ComClient.GetChColByEnCol(TabNam, PriKey)].ToString() + "'", "Panel4", "", ""));
                        //获取执行SQL
                        foreach (ExpandoObject EObj in List_EObj)
                        {
                            var IDObj = (IDictionary <string, object>)EObj;
                            SQL = (string)IDObj["SQL"];
                        }
                    }
                    else if (BtnName == BtnNam.Enable)
                    {
                        //根据表名和窗体实例名查询出更新表需要的关键信息
                        List_EObj = LoadData(ComClient.GetTabStrc(TabNam, FrmNam, OperType.Enable, PriKey + " ='" + IDObj1[ComClient.GetChColByEnCol(TabNam, PriKey)].ToString() + "'", "Panel4", "", ""));
                        //获取执行SQL
                        foreach (ExpandoObject EObj in List_EObj)
                        {
                            var IDObj = (IDictionary <string, object>)EObj;
                            SQL = (string)IDObj["SQL"];
                        }
                    }

                    //ComClient.SaveData(Serializer.SerializeDTToXml<List<DTSerializer<string, object>>>(List_DTObj), SQL, OperType.UnApprove);
                    ComClient.SaveData1("", SQL);
                    //提交事务
                    ComClient.CommitTransaction();
                    BtnName = BtnNam.Null;
                    //重新刷新网格数据
                    Grip_Common2.DataSource = LoadData(UsrGroupClient.GetUsrGrpsToChCol("#Tmp_" + CurUsrID + "_" + DateTime.Now.Second.ToString(), "0", ""));
                }
                else
                {
                    Common.ShowMsg("用户组代号不允许重复!");
                    return(0);
                }
            }
            catch (Exception Ex)
            {
                //关闭当前SQL连接
                ComClient.CloseSqlCon();
                Common.ShowMsg(Ex.Message);
            }
            return(0);
        }