Ejemplo n.º 1
0
        /// <summary>
        /// 根据点击的按钮名称更改按钮状态
        /// </summary>
        /// <param name="BtnName">按钮名称</param>
        private void EnabledByBtnNam(BtnNam BtnName)
        {
            try
            {
                if (BtnName == BtnNam.Add || BtnName == BtnNam.Edit || BtnName == BtnNam.Copy)
                {
                    //点击新增或修改,保存和取消亮起,其他失效
                    Btn_Add.Enabled       = false;
                    Btn_Copy.Enabled      = false;
                    Btn_Edit.Enabled      = false;
                    Btn_Delete.Enabled    = false;
                    Btn_Unapprove.Enabled = false;
                    Btn_Approve.Enabled   = false;
                    Btn_Filter.Enabled    = false;
                    Btn_Disable.Enabled   = false;
                    Btn_Exit.Enabled      = false;
                    Btn_Enable.Enabled    = false;

                    Btn_Save.Enabled   = true;
                    Btn_Cancel.Enabled = true;
                }
                else if (BtnName == BtnNam.Cancel)
                {
                    //点击取消,根据当前定位记录的审核状态和启用状态设置按钮的Enable状态

                    //
                    dynamic EObject = (ExpandoObject)View_Common2.GetFocusedRow();
                }
            }
            catch (Exception Ex)
            {
                Common.ShowMsg(Ex.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 窗体加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmCommon_Load(object sender, EventArgs e)
        {
            try
            {
                ComClient       = new EPortalService.CommonClient();
                DataTransformer = new DataTransform();
                ComClient.SetCurUsrInfo(CurUsrID, CurUsrName);
                //设置行序号列的宽度
                this.View_Common1.IndicatorWidth = 36;
                this.View_Common2.IndicatorWidth = 36;
                this.View_Common3.IndicatorWidth = 36;
                //注册自动计算行号事件
                this.View_Common1.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(this.View_Common1_CustomDrawRowIndicator);
                this.View_Common2.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(this.View_Common2_CustomDrawRowIndicator);
                this.View_Common3.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(this.View_Common3_CustomDrawRowIndicator);
                //设置当前选择页签
                //Tab_Common1.SelectedTabPage = Page_Preview;
                //失效详细信息页签上的控件
                EDabDtControls(EDabType.Disable);

                Grip_Common2.DataSource = InitGridData("0");
                AssiValue();
                ExpandoObject EObject = (ExpandoObject)View_Common2.GetFocusedRow();
                ShowData(Grip_Common3, GetDataByFocRow(EObject, "Panel6"), GetDataByPKToChCol("Panel6"), View_Common3, "Panel6");
                ShowData(Grip_Common1, GetDataByFocRow(EObject, "Panel3"), GetDataByPKToChCol("Panel3"), View_Common1, "Panel3");
            }
            catch (Exception Ex)
            {
                Common.ShowMsg(Ex.Message);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 鼠标点击事件(点击主表自动关联显示细表)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Grip_Comon2_Click(object sender, EventArgs e)
 {
     try
     {
         ExpandoObject EObject = (ExpandoObject)View_Common2.GetFocusedRow();
         ShowData(Grip_Common3, GetDataByFocRow(EObject, "Panel6"), GetDataByPKToChCol("Panel6"), View_Common3, "Panel6");
     }
     catch (Exception Ex)
     {
         Common.ShowMsg(Ex.Message);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 双击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Grip_Comon2_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         Tab_Common1.SelectedTabPage = Page_Detail;
         AssiValue();
         ExpandoObject EObject = (ExpandoObject)View_Common2.GetFocusedRow();
         ShowData(Grip_Common1, GetDataByFocRow(EObject, "Panel3"), GetDataByPKToChCol("Panel3"), View_Common1, "Panel3");
     }
     catch (Exception Ex)
     {
         Common.ShowMsg(Ex.Message);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 页签切换事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Tab_Common1_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
 {
     try
     {
         if (e.Page.Name == "Page_Detail")
         {
             AssiValue();
             ExpandoObject EObject = (ExpandoObject)View_Common2.GetFocusedRow();
             ShowData(Grip_Common1, GetDataByFocRow(EObject, "Panel3"), GetDataByPKToChCol("Panel3"), View_Common1, "Panel3");
         }
     }
     catch (Exception Ex)
     {
         Common.ShowMsg(Ex.Message);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 根据当前选择行改变按钮Enable状态
        /// </summary>
        public void BtnEnabledByFocusRow()
        {
            dynamic EObject = (ExpandoObject)View_Common2.GetFocusedRow();

            if (EObject.审核状态 == "已审核" && EObject.是否启用 == "已启用")
            {
                BtnEnabledByState(State.Check, State.Enable);
            }
            else if (EObject.审核状态 == "已审核" && EObject.是否启用 == "未启用")
            {
                BtnEnabledByState(State.Check, State.Disable);
            }
            else if (EObject.审核状态 == "未审核" && EObject.是否启用 == "已启用")
            {
                BtnEnabledByState(State.Uncheck, State.Enable);
            }
            else if (EObject.审核状态 == "未审核" && EObject.是否启用 == "未启用")
            {
                BtnEnabledByState(State.Uncheck, State.Disable);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 过滤事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Btn_Filter_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     BtnName = BtnNam.Filter;
     if (CurFilter == null)
     {
         CurFilter             = new DiousEPortal.FrmFilter();
         CurFilter.CurUsrID    = CurUsrID;
         CurFilter.CurUsrName  = CurUsrName;
         CurFilter.ComClient   = ComClient;
         CurFilter.FrmNam      = FrmNam;
         CurFilter.CurOperType = OperType.InitFilter;
     }
     else
     {
         CurFilter.CurOperType = OperType.ShowFilter;
     }
     CurFilter.ShowDialog();
     //11
     //获取到过滤SQL
     FltSQL = CurFilter.FltSQL;
     if (FltSQL != null)
     {
         List <ExpandoObject> DataSource = InitGridData("0", FltSQL);
         if (DataSource.Count > 0)
         {
             Grip_Common2.DataSource = DataSource;
             AssiValue();
             ExpandoObject EObject = (ExpandoObject)View_Common2.GetFocusedRow();
             ShowData(Grip_Common3, GetDataByFocRow(EObject, "Panel6"), GetDataByPKToChCol("Panel6"), View_Common3, "Panel6");
             ShowData(Grip_Common1, GetDataByFocRow(EObject, "Panel3"), GetDataByPKToChCol("Panel3"), View_Common1, "Panel3");
         }
         else
         {
             Grip_Common1.DataSource = null;
             Grip_Common2.DataSource = null;
             Grip_Common3.DataSource = null;
         }
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 定位行事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void View_Common2_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            try
            {
                if (Grip_Common2.DataSource != null)
                {
                    if (BtnName != BtnNam.Null)
                    {
                        dynamic EObject = (ExpandoObject)View_Common2.GetFocusedRow();
                        FocColVal = EObject.分组代号;
                        //LocRowByVal(View_Common2, FocColNam, EObject.分组代号);
                        //View_Common2.FocusedRowHandle;
                    }

                    BtnEnabledByFocusRow();
                }
            }
            catch (Exception Ex)
            {
                Common.ShowMsg(Ex.Message);
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 取消事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Btn_Cancel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         BtnName = BtnNam.Cancel;
         BtnEnabledByFocusRow();
         Page_Detail.PageEnabled = true;
         EDabDtControls(EDabType.Disable);
         AssiValue();
         Page_Preview.PageEnabled = true;
         View_Common1.DeleteSelectedRows();
         View_Common1.CloseEditor();
         View_Common1.OptionsBehavior.Editable = false;
         View_Common1.OptionsBehavior.ReadOnly = true;
         //重新刷新数据
         ExpandoObject EObject = (ExpandoObject)View_Common2.GetFocusedRow();
         ShowData(Grip_Common1, GetDataByFocRow(EObject, "Panel3"), GetDataByPKToChCol("Panel3"), View_Common1, "Panel3");
     }
     catch (Exception Ex)
     {
         Common.ShowMsg(Ex.Message);
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// 根据当前定位的网格行数据给Detail页签上的控件Text属性动态赋值
        /// </summary>
        public void AssiValue()
        {
            try
            {
                dynamic EObject = (ExpandoObject)View_Common2.GetFocusedRow();
                IDictionary <string, object> IDObj = EObject;
                //根据面板名称读取该面板内所有相关字段信息
                List <ExpandoObject> List_EObj = Serializer.DeserializeXMLToEObject(GetColsByPanelNam("Panel4", FrmNam, ""));

                //遍历字段列表设置网格控件单元格字段属性
                foreach (dynamic EObj in List_EObj)
                {
                    if (EObj.FContrNam != "")
                    {
                        Panel4.Controls[EObj.FContrNam].Text = IDObj[EObj.FRemark];
                    }
                }
                ShowData(Grip_Common1, GetDataByFocRow(EObject, "Panel3"), GetDataByPKToChCol("Panel3"), View_Common1, "Panel3");
            }
            catch (Exception Ex)
            {
                Common.ShowMsg(Ex.Message);
            }
        }
Ejemplo n.º 11
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);
        }