Пример #1
0
        /// <summary>
        /// 覆盖方案事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                //获取面板中最后一个用户控件
                int             ContrNum = Pal_FlCtner.Controls.Count;
                UsrContr_Filter Filter   = (UsrContr_Filter)Pal_FlCtner.Controls[ContrNum - 1];

                if (((SearchLookUpEdit)Filter.Controls["SLkUp_ColNams"]).EditValue != null)
                {
                    if (BracketsMatch(GetFltSltDtl()))
                    {
                        DialogResult Result = XtraMessageBox.Show("您是否需要覆盖本过滤方案!", "提醒", MessageBoxButtons.OKCancel);
                        if (Result == DialogResult.OK)
                        {
                            //EditFltSlt();
                            if (SltEditNode != null)
                            {
                                List <DTSerializer <string, object> > List_DTObj = GetFltSltDtl();
                                foreach (DTSerializer <string, object> DTObj2 in List_DTObj)
                                {
                                    DTObj2.Add("FSltID", SltEditNode.GetValue("FSltID").ToString());
                                    DTObj2.Add("FSltType", "0");
                                }
                                //开始事务
                                ComClient.BeginTransaction();
                                ComClient.SaveFltSlt1(OperType.Delete, Serializer.SerializeDTToXml <List <DTSerializer <string, object> > >(List_DTObj), "t_ADMM_FltSltforDtl", " FSltID='" + SltEditNode.GetValue("FSltID").ToString() + "'");
                                ComClient.SaveFltSlt1(OperType.AddSave, Serializer.SerializeDTToXml <List <DTSerializer <string, object> > >(List_DTObj), "t_ADMM_FltSltforDtl", "");
                                //提交事务
                                ComClient.CommitTransaction();
                                //将树节点切换成不可编辑模式
                                TrList_FltSlt.OptionsBehavior.Editable = false;
                            }
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    Common.ShowMsg("字段名称不能为空!");
                }
            }
            catch (Exception Ex)
            {
                Common.ShowMsg(Ex.Message);
            }
        }
Пример #2
0
        /// <summary>
        /// 保存过滤方案
        /// </summary>
        /// <param name="operType">操作类型</param>
        /// <param name="TabName">表名称</param>
        /// <param name="ParentID">父方案ID</param>
        /// <param name="SltType">过滤方案类型</param>
        /// <param name="KeyWords">查询关键字</param>
        private void AddFltSlt(OperType operType, string ParentID, string SltType, string KeyWords, List <DTSerializer <string, object> > List_DTObj)
        {
            try
            {
                //获取当前最大的方案ID
                string MaxSltID = ComClient.GetMaxSltID(FrmNam, SltType, ParentID);
                DTSerializer <string, object>         DTObj1      = new DTSerializer <string, object>();
                List <DTSerializer <string, object> > List_DTObj1 = new List <DTSerializer <string, object> >();
                DTObj1.Add("FSltID", MaxSltID);
                DTObj1.Add("FSltName", Txt_SltName.Text.Trim());
                DTObj1.Add("FParentID", ParentID);
                DTObj1.Add("FUsrID", CurUsrID);
                DTObj1.Add("FFrmName", FrmNam);
                DTObj1.Add("FSltType", SltType);
                List_DTObj1.Add(DTObj1);

                //开始SQL事务
                ComClient.BeginTransaction();
                ComClient.SaveFltSlt1(operType, Serializer.SerializeDTToXml <List <DTSerializer <string, object> > >(List_DTObj1), "t_ADMM_FltSltList", KeyWords);

                //向查询方案明细中追加方案ID和方案类型
                foreach (DTSerializer <string, object> DTObj2 in List_DTObj)
                {
                    DTObj2.Add("FSltID", MaxSltID);
                    DTObj2.Add("FSltType", SltType);
                }

                //增加/修改/删除过滤方案明细
                ComClient.SaveFltSlt1(operType, Serializer.SerializeDTToXml <List <DTSerializer <string, object> > >(List_DTObj), "t_ADMM_FltSltforDtl", KeyWords);
                //提交事务
                ComClient.CommitTransaction();
            }
            catch (Exception Ex)
            {
                Common.ShowMsg(Ex.Message);
            }
        }