Example #1
0
        public override bool SaveUpdated()
        {
            DictTypeInfo info = BLLFactory <DictType> .Instance.FindByID(ID);

            if (info != null)
            {
                SetInfo(info);
                try
                {
                    #region 更新数据
                    bool succeed = BLLFactory <DictType> .Instance.Update(info, info.ID.ToString());

                    if (succeed)
                    {
                        //可添加其他关联操作

                        return(true);
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(LogLevel.LOG_LEVEL_CRIT, ex, typeof(FrmEditDictType));
                    MessageDxUtil.ShowError(ex.Message);
                }
            }
            return(false);
        }
Example #2
0
        /// <summary>
        /// 编辑分类
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menu_EditType_Click(object sender, EventArgs e)
        {
            if (!HasFunction("Dictionary/Set/DictTypeEdit"))
            {
                MessageDxUtil.ShowError(Const.NoAuthMsg);
                return;
            }

            TreeNode selectedNode = this.treeView1.SelectedNode;

            if (selectedNode != null && selectedNode.Tag != null)
            {
                Int32        typeId = Convert.ToInt32(selectedNode.Tag);
                DictTypeInfo info   = BLLFactory <DictType> .Instance.FindById(typeId);

                if (info != null)
                {
                    FrmEditDictType dlg = new FrmEditDictType();
                    dlg.Id           = typeId;
                    dlg.pId          = info.Pid;
                    dlg.OnDataSaved += new EventHandler(dlg_OnDataTreeSaved);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        InitTreeView();
                    }
                }
            }
        }
Example #3
0
        public override bool SaveAddNew()
        {
            DictTypeInfo info = new DictTypeInfo();

            SetInfo(info);

            try
            {
                #region 新增数据

                bool succeed = BLLFactory <DictType> .Instance.Insert(info);

                if (succeed)
                {
                    //可添加其他关联操作

                    return(true);
                }
                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(LogLevel.LOG_LEVEL_CRIT, ex, typeof(FrmEditDictType));
                MessageDxUtil.ShowError(ex.Message);
            }
            return(false);
        }
Example #4
0
        /// <summary>
        /// 数据显示的函数
        /// </summary>
        public override void DisplayData()
        {
            DictTypeInfo parentInfo = BLLFactory <DictType> .Instance.FindByID(PID);

            if (parentInfo != null)
            {
                this.txtParent.Text = parentInfo.Name;
                this.txtParent.Tag  = parentInfo.Name;
            }

            if (!string.IsNullOrEmpty(ID))
            {
                DictTypeInfo info = BLLFactory <DictType> .Instance.FindByID(ID);

                if (info != null)
                {
                    this.txtID.Text    = info.ID.ToString();
                    this.txtID.Enabled = false;
                    this.txtName.Text  = info.Name;
                    this.txtNote.Text  = info.Remark;
                    this.txtSeq.Text   = info.Seq;

                    if (info.PID == -1)
                    {
                        this.chkTopItem.Checked = true;
                    }
                }
            }
            this.txtName.Focus();
        }
Example #5
0
        bool drager_ProcessDragNode(TreeNode dragNode, TreeNode dropNode)
        {
            if (dragNode != null && dragNode.Text == "数据字典管理")
            {
                return(false);
            }

            if (dropNode != null && dropNode.Tag != null)
            {
                string dropTypeId = dropNode.Tag.ToString();
                string dragTypeId = dragNode.Tag.ToString();
                //MessageDxUtil.ShowTips(string.Format("dropTypeId:{0} dragTypeId:{1}", dropTypeId, drageTypeId));

                try
                {
                    DictTypeInfo dragTypeInfo = BLLFactory <DictType> .Instance.FindByID(dragTypeId);

                    if (dragTypeInfo != null)
                    {
                        dragTypeInfo.PID = dropTypeId;
                        BLLFactory <DictType> .Instance.Update(dragTypeInfo, dragTypeInfo.ID);
                    }
                }
                catch (Exception ex)
                {
                    LogTextHelper.Error(ex);
                    MessageDxUtil.ShowError(ex.Message);
                    return(false);
                }
            }
            return(true);
        }
Example #6
0
        public override bool SaveUpdated()
        {
            DictTypeInfo info          = new DictTypeInfo();
            XmlHelper    xmldicthelper = new XmlHelper(@"XML\dict.xml");
            XmlNodeList  xmlNodeLst    = xmldicthelper.Read(string.Format("datatype/dataitem/item[id=\"{0}\"]", Id));

            info.Id     = xmlNodeLst[0].ChildNodes.Item(0).InnerText.ToString().ToInt32();
            info.Pid    = xmlNodeLst[1].ChildNodes.Item(0).InnerText.ToString().ToInt32();
            info.Name   = xmlNodeLst[2].ChildNodes.Item(0) == null ? string.Empty : xmlNodeLst[2].ChildNodes.Item(0).InnerText;
            info.Seq    = xmlNodeLst[0].ChildNodes.Item(0) == null ? string.Empty : xmlNodeLst[0].ChildNodes.Item(0).InnerText;
            info.Remark = xmlNodeLst[3].ChildNodes.Item(0) == null ? string.Empty : xmlNodeLst[3].ChildNodes.Item(0).InnerText;

            if (info != null)
            {
                SetInfo(info);
                try
                {
                    #region 更新数据
                    xmldicthelper.Replace(string.Format("datatype/dataitem/item[id=\"{0}\"]/pid", Id), info.Pid.ToString());
                    xmldicthelper.Replace(string.Format("datatype/dataitem/item[id=\"{0}\"]/name", Id), info.Name);
                    xmldicthelper.Replace(string.Format("datatype/dataitem/item[id=\"{0}\"]/remark", Id), info.Remark);
                    xmldicthelper.Save(false);
                    return(true);

                    #endregion
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(LogLevel.LOG_LEVEL_CRIT, ex, typeof(FrmEditDictType));
                    MessageDxUtil.ShowError(ex.Message);
                }
            }
            return(false);
        }
Example #7
0
        private void FrmEditDictData_Load(object sender, EventArgs e)
        {
            DictTypeInfo parentInfo = BLLFactory <DictType> .Instance.FindByID(PID);

            if (parentInfo != null)
            {
                this.txtParent.Text = parentInfo.Name;
                this.txtParent.Tag  = parentInfo.Name;
            }

            if (!string.IsNullOrEmpty(ID))
            {
                this.Text = string.Format("{0} {1}", JsonLanguage.Default.GetString("编辑"), JsonLanguage.Default.GetString(this.Text));
                DictTypeInfo info = BLLFactory <DictType> .Instance.FindByID(ID);

                if (info != null)
                {
                    this.txtName.Text = info.Name;
                    this.txtCode.Text = info.Code;
                    this.txtNote.Text = info.Remark;
                    this.txtSeq.Text  = info.Seq;
                    if (info.PID == "-1")
                    {
                        this.chkTopItem.Checked = true;
                    }
                }
                //this.btnOK.Enabled = Portal.gc.HasFunction("Product/Modify");
            }
            else
            {
                this.Text = string.Format("{0} {1}", JsonLanguage.Default.GetString("新建"), JsonLanguage.Default.GetString(this.Text));
                //this.btnOK.Enabled = Portal.gc.HasFunction("Product/Add");
            }
            this.txtName.Focus();
        }
Example #8
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        DictTypeInfo info = new DictTypeInfo();

        info.Code = this.TXT_CODE.Text.Trim();
        info.Name = this.TXT_NAME.Text.Trim();
        if (this.TXT_CODE.Enabled)
        {
            if (_Dict.CreateDictType(info))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('字典类型新增成功!');</script>");
                BindGridView();
                ClearPage();
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('字典类型新增失败!');</script>");
            }
        }
        else
        {
            if (_Dict.ModifyDictType(info))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('字典类型编辑成功!');</script>");
                BindGridView();
                ClearPage();
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('字典类型编辑失败!');</script>");
            }
        }

        this.TXT_CODE.Enabled = true;
    }
Example #9
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (this.txtName.Text.Trim().Length == 0)
            {
                MessageDxUtil.ShowTips("请输入项目名称");
                this.txtName.Focus();
                return;
            }

            if (!string.IsNullOrEmpty(ID))
            {
                DictTypeInfo info = BLLFactory <DictType> .Instance.FindByID(ID);

                if (info != null)
                {
                    SetInfo(info);

                    try
                    {
                        bool succeed = BLLFactory <DictType> .Instance.Update(info, info.ID.ToString());

                        if (succeed)
                        {
                            ProcessDataSaved(this.btnOK, new EventArgs());
                            MessageDxUtil.ShowTips("保存成功");
                            this.DialogResult = DialogResult.OK;
                        }
                    }
                    catch (Exception ex)
                    {
                        LogTextHelper.Error(ex);
                        MessageDxUtil.ShowError(ex.Message);
                    }
                }
            }
            else
            {
                DictTypeInfo info = new DictTypeInfo();
                SetInfo(info);

                try
                {
                    bool succeed = BLLFactory <DictType> .Instance.Insert(info);

                    if (succeed)
                    {
                        ProcessDataSaved(this.btnOK, new EventArgs());
                        MessageDxUtil.ShowTips("保存成功");
                        this.DialogResult = DialogResult.OK;
                    }
                }
                catch (Exception ex)
                {
                    LogTextHelper.Error(ex);
                    MessageDxUtil.ShowError(ex.Message);
                }
            }
        }
Example #10
0
        /// <summary>
        /// 根据查询条件导出列表数据
        /// </summary>
        /// <returns></returns>
        public ActionResult Export()
        {
            #region 根据参数获取List列表
            string where = GetPagerCondition();
            string CustomedCondition = Request["CustomedCondition"] ?? "";
            List <DictDataInfo> list = new List <DictDataInfo>();

            if (!string.IsNullOrWhiteSpace(CustomedCondition))
            {
                //如果为自定义的json参数列表,那么可以使用字典反序列化获取参数,然后处理
                //Dictionary<string, string> dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(CustomedCondition);

                //如果是条件的自定义,可以使用Find查找
                list = baseBLL.Find(CustomedCondition, "order by DictType_ID, seq");
            }
            else
            {
                list = baseBLL.Find(where, "order by DictType_ID, seq");
            }

            #endregion

            #region 把列表转换为DataTable
            DataTable datatable = DataTableHelper.CreateTable("序号|int," + columnString);
            DataRow   dr;
            int       j = 1;
            for (int i = 0; i < list.Count; i++)
            {
                dr       = datatable.NewRow();
                dr["序号"] = j++;
                DictTypeInfo typeInfo = BLLFactory <DictType> .Instance.FindByID(list[i].DictType_ID);

                if (typeInfo != null)
                {
                    dr["字典大类"] = typeInfo.Name;
                }
                dr["字典名称"] = list[i].Name;
                dr["字典值"]  = list[i].Value;
                dr["备注"]   = list[i].Remark;
                dr["排序"]   = list[i].Seq;

                datatable.Rows.Add(dr);
            }
            #endregion

            #region 把DataTable转换为Excel并输出

            //根据用户创建目录,确保生成的文件不会产生冲突
            string filePath = string.Format("/GenerateFiles/{0}/DictData.xls", CurrentUser.Name);
            GenerateExcel(datatable, filePath);

            #endregion

            //返回生成后的文件路径,让客户端根据地址下载
            return(Content(filePath));
        }
Example #11
0
        /// <summary>
        /// 数据显示的函数
        /// </summary>
        public override void DisplayData()
        {
            XmlHelper   xmldicthelper = new XmlHelper(@"XML\dict.xml");
            XmlNodeList xmlNodeLst    = xmldicthelper.Read("datatype/dataitem");

            this.txtParent.Text = string.Empty;
            this.txtParent.Tag  = string.Empty;
            DictTypeInfo info = null;

            for (Int32 i = 0; i < xmlNodeLst.Count; i++)
            {
                // 将节点转换为元素,便于得到节点的属性值
                XmlElement xe = (XmlElement)xmlNodeLst[i];

                // 得到DataTypeInfo节点的所有子节点
                XmlNodeList xnl0 = xe.ChildNodes;

                if (Pid != -1 && Pid == xnl0.Item(0).InnerText.ToString().ToInt32())
                {
                    this.txtParent.Text = string.Format("{0}-{1}", xnl0.Item(0).InnerText, xnl0.Item(2).InnerText);
                    // 保存上一个节点的PID 值
                    this.txtParent.Tag = xnl0.Item(1).InnerText;
                }

                if (xnl0.Item(0).InnerText.ToString().ToInt32() == Id)
                {
                    info        = new DictTypeInfo();
                    info.Id     = xnl0.Item(0).InnerText.ToString().ToInt32();
                    info.Pid    = xnl0.Item(1).InnerText.ToString().ToInt32();
                    info.Name   = xnl0.Item(2).InnerText;
                    info.Remark = xnl0.Item(3).InnerText;
                }
            }

            if (Id > 0)
            {
                this.chkTopItem.Enabled = false;
                if (info != null)
                {
                    this.txtID.Text    = info.Id.ToString();
                    this.txtID.Enabled = false;
                    this.txtName.Text  = info.Name;
                    this.txtNote.Text  = info.Remark;

                    if (info.Pid == -1)
                    {
                        this.chkTopItem.Checked = true;
                    }
                }
            }
            this.txtName.Focus();
        }
Example #12
0
        private void FrmBatchAddDictData_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(ID))
            {
                DictTypeInfo info = BLLFactory <DictType> .Instance.FindByID(ID);

                if (info != null)
                {
                    this.txtDictType.Text = info.Name;
                    this.txtDictCode.Text = info.Code;
                }
            }
        }
Example #13
0
 private void SetInfo(DictTypeInfo info)
 {
     info.Id = txtID.Text.ToInt32();
     //info.EditorId = LoginUserInfo.Id;
     //info.CurrentLoginUserId = LoginUserInfo.Id;
     info.LastUpdateTime = DateTimeHelper.GetServerDateTime2();
     info.Name           = this.txtName.Text.Trim();
     info.Remark         = this.txtNote.Text.Trim();
     info.Pid            = Pid;
     if (this.chkTopItem.Checked)
     {
         info.Pid = -1;
     }
 }
Example #14
0
 private void SetInfo(DictTypeInfo info)
 {
     info.Editor      = LoginID;
     info.LastUpdated = DateTime.Now;
     info.Name        = this.txtName.Text.Trim();
     info.Code        = this.txtCode.Text.Trim();
     info.Remark      = this.txtNote.Text.Trim();
     info.Seq         = this.txtSeq.Text;
     info.PID         = PID;
     if (this.chkTopItem.Checked)
     {
         info.PID = "-1";
     }
 }
Example #15
0
        /// <summary>
        /// 获取服务器上的Excel文件,并把它转换为实体列表返回给客户端
        /// </summary>
        /// <param name="guid">附件的GUID</param>
        /// <returns></returns>
        public ActionResult GetExcelData(string guid)
        {
            if (string.IsNullOrEmpty(guid))
            {
                return(null);
            }

            List <DictDataInfo> list = new List <DictDataInfo>();

            DataTable table = ConvertExcelFileToTable(guid);

            if (table != null)
            {
                #region 数据转换
                int i = 1;
                foreach (DataRow dr in table.Rows)
                {
                    bool     converted = false;
                    DateTime dtDefault = Convert.ToDateTime("1900-01-01");
                    DateTime dt;

                    string typeName = dr["字典大类"].ToString();
                    if (!string.IsNullOrEmpty(typeName))
                    {
                        DictTypeInfo typeInfo = BLLFactory <DictType> .Instance.FindSingle(string.Format("Name ='{0}'", typeName));

                        if (typeInfo != null)
                        {
                            DictDataInfo info = new DictDataInfo();
                            info.DictType_ID = typeInfo.ID;

                            info.Name   = dr["字典名称"].ToString();
                            info.Value  = Convert.ToInt32(dr["字典值"]);
                            info.Remark = dr["备注"].ToString();
                            info.Seq    = dr["排序"].ToString();

                            info.Editor      = CurrentUser.ID.ToString();
                            info.LastUpdated = DateTime.Now;

                            list.Add(info);
                        }
                    }
                }
                #endregion
            }

            var result = new { total = list.Count, rows = list };
            return(ToJsonContentDate(result));
        }
Example #16
0
        private void SetInfo(DictTypeInfo info)
        {
            info.ID          = Convert.ToInt32(txtID.Text);
            info.Editor      = LoginUserInfo.ID.ToString();
            info.LastUpdated = DateTimeHelper.GetServerDateTime2();
            info.Name        = this.txtName.Text.Trim();
            info.Remark      = this.txtNote.Text.Trim();
            info.PID         = PID;
            if (this.chkTopItem.Checked)
            {
                info.PID = -1;
            }

            info.CurrentLoginUserId = LoginUserInfo.ID;
        }
Example #17
0
        /// <summary>
        /// 保存客户端上传的相关数据列表
        /// </summary>
        /// <param name="list">数据列表</param>
        /// <returns></returns>
        public ActionResult SaveExcelData(List <DictDataInfo> list)
        {
            CommonResult result = new CommonResult();

            if (list != null && list.Count > 0)
            {
                #region 采用事务进行数据提交

                DbTransaction trans = BLLFactory <DictData> .Instance.CreateTransaction();

                if (trans != null)
                {
                    try
                    {
                        //int seq = 1;
                        foreach (DictDataInfo detail in list)
                        {
                            DictTypeInfo typeInfo = BLLFactory <DictType> .Instance.FindSingle(string.Format("Name ='{0}'", detail.DictType_ID));

                            if (typeInfo != null)
                            {
                                //detail.Seq = seq++;//增加1
                                detail.Editor      = CurrentUser.ID.ToString();
                                detail.LastUpdated = DateTime.Now;

                                BLLFactory <DictData> .Instance.Insert(detail, trans);
                            }
                        }
                        trans.Commit();
                        result.Success = true;
                    }
                    catch (Exception ex)
                    {
                        LogHelper.WriteLog(LogLevel.LOG_LEVEL_CRIT, ex, typeof(DictDataController));
                        result.ErrorMessage = ex.Message;
                        trans.Rollback();
                    }
                }
                #endregion
            }
            else
            {
                result.ErrorMessage = "导入信息不能为空";
            }

            return(ToJsonContent(result));
        }
Example #18
0
        /// <summary>
        /// 根据文件的GUID转换为强类型对象列表
        /// </summary>
        /// <param name="guid">上传的文件GUID</param>
        /// <returns></returns>
        private List <DictDataInfo> GetExcelList(string guid)
        {
            List <DictDataInfo> list = new List <DictDataInfo>();

            if (!string.IsNullOrEmpty(guid))
            {
                DataTable table = ConvertExcelFileToTable(guid);
                if (table != null)
                {
                    #region 数据转换
                    foreach (DataRow dr in table.Rows)
                    {
                        bool     converted = false;
                        DateTime dtDefault = Convert.ToDateTime("1900-01-01");
                        DateTime dt;

                        string typeName = dr["字典大类"].ToString();
                        if (!string.IsNullOrEmpty(typeName))
                        {
                            DictTypeInfo typeInfo = BLLFactory <DictType> .Instance.FindSingle(string.Format("Name ='{0}'", typeName));

                            if (typeInfo != null)
                            {
                                DictDataInfo info = new DictDataInfo();
                                info.DictType_ID = typeInfo.ID;
                                info.Data1       = typeInfo.Name;//传递给界面显示名称

                                info.Name   = dr["字典名称"].ToString();
                                info.Value  = dr["字典值"].ToString();
                                info.Remark = dr["备注"].ToString();
                                info.Seq    = dr["排序"].ToString();

                                info.Editor      = CurrentUser.ID.ToString();
                                info.LastUpdated = DateTime.Now;

                                list.Add(info);
                            }
                        }
                    }
                    #endregion
                }
            }
            return(list);
        }
Example #19
0
        /// <summary>
        /// 拖放事件
        /// </summary>
        /// <param name="dragNode"></param>
        /// <param name="dropNode"></param>
        /// <returns></returns>
        bool drager_ProcessDragNode(TreeNode dragNode, TreeNode dropNode)
        {
            if (!HasFunction("DicSet/DictTypeDrag"))
            {
                MessageDxUtil.ShowError(Const.NoAuthMsg);
                return(false);
            }

            if (dragNode != null && dragNode.Text == "数据字典管理")
            {
                return(false);
            }

            if (dropNode != null && dropNode.Tag != null)
            {
                string dropTypeId = dropNode.Tag.ToString();
                string dragTypeId = dragNode.Tag.ToString();
                //MessageDxUtil.ShowTips(string.Format("dropTypeId:{0} dragTypeId:{1}", dropTypeId, drageTypeId));

                try
                {
                    DictTypeInfo dragTypeInfo = BLLFactory <DictType> .Instance.FindByID(dragTypeId);

                    if (dragTypeInfo != null)
                    {
                        dragTypeInfo.PID = Convert.ToInt32(dropTypeId);
                        BLLFactory <DictType> .Instance.Update(dragTypeInfo, dragTypeInfo.ID);
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog(LogLevel.LOG_LEVEL_CRIT, ex, typeof(FrmDictionary));
                    MessageDxUtil.ShowError(ex.Message);
                    return(false);
                }
            }
            return(true);
        }
Example #20
0
        public override bool SaveAddNew()
        {
            DictTypeInfo info = new DictTypeInfo();

            SetInfo(info);

            try
            {
                #region 新增数据
                XmlHelper xmldicthelper = new XmlHelper(@"XML\dict.xml");
                xmldicthelper.InsertElement("datatype/dataitem", "item", string.Format(dicttypeModel, info.Id, info.Pid, info.Name, info.Remark, string.Empty));
                xmldicthelper.Save(false);
                return(true);

                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(LogLevel.LOG_LEVEL_CRIT, ex, typeof(FrmEditDictType));
                MessageDxUtil.ShowError(ex.Message);
            }
            return(false);
        }
Example #21
0
        private void menu_EditType_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = this.treeView1.SelectedNode;

            if (selectedNode != null && selectedNode.Tag != null)
            {
                string       typeId = selectedNode.Tag.ToString();
                DictTypeInfo info   = BLLFactory <DictType> .Instance.FindByID(typeId);

                if (info != null)
                {
                    FrmEditDictType dlg = new FrmEditDictType();
                    dlg.ID      = typeId;
                    dlg.PID     = info.PID;
                    dlg.LoginID = LoginID;
                    if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        InitTreeView();
                        BindData();
                    }
                }
            }
        }
Example #22
0
        public override void DisplayData()
        {
            if (!string.IsNullOrEmpty(ID))
            {
                DictDataInfo info = BLLFactory <DictData> .Instance.FindByID(ID);

                if (info != null)
                {
                    DictTypeInfo typeInfo = BLLFactory <DictType> .Instance.FindByID(info.DictType_ID.ToString());

                    this.txtDictType.Text    = typeInfo.Name;
                    this.txtDictType.Tag     = typeInfo.ID;
                    this.txtDictType.Enabled = false;

                    this.txtName.Text  = info.Name;
                    this.txtNote.Text  = info.Remark;
                    this.txtSeq.Text   = info.Seq;
                    this.txtValue.Text = info.Value.ToString();
                }
            }

            this.txtName.Focus();
        }
Example #23
0
        public override void DisplayData()
        {
            if (Id > 0)
            {
                string       Gid  = Tag.ToString();
                DictDataInfo info = BLLFactory <DictData> .Instance.FindById(Gid);

                if (info != null)
                {
                    DictTypeInfo typeInfo = BLLFactory <DictType> .Instance.FindById(info.DicttypeId);

                    this.txtDictType.Text    = typeInfo.Name;
                    this.txtDictType.Tag     = typeInfo.Id;
                    this.txtDictType.Enabled = false;
                    this.txtName.Text        = info.Name;
                    this.txtNote.Text        = info.Remark;
                    this.txtSeq.Text         = info.Seq;
                    this.txtValue.Text       = info.DicttypeValue.ToString();
                }
            }

            this.txtName.Focus();
        }
Example #24
0
        private void FrmEditDictData_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(TypeID))
            {
                DictTypeInfo typeInfo = BLLFactory <DictType> .Instance.FindByID(TypeID);

                if (typeInfo != null)
                {
                    this.txtDictType.Text = typeInfo.Name;
                    this.txtDictType.Tag  = typeInfo.ID;
                    this.txtDictCode.Text = typeInfo.Code;
                }
            }

            if (!string.IsNullOrEmpty(ID))
            {
                this.Text = string.Format("{0} {1}", JsonLanguage.Default.GetString("编辑"), JsonLanguage.Default.GetString(this.Text));
                DictDataInfo info = BLLFactory <DictData> .Instance.FindByID(ID);

                if (info != null)
                {
                    this.txtName.Text  = info.Name;
                    this.txtNote.Text  = info.Remark;
                    this.txtSeq.Text   = info.Seq;
                    this.txtValue.Text = info.Value;
                }
                //this.btnOK.Enabled = Portal.gc.HasFunction("Product/Modify");
            }
            else
            {
                this.Text = string.Format("{0} {1}", JsonLanguage.Default.GetString("新建"), JsonLanguage.Default.GetString(this.Text));
                //this.btnOK.Enabled = Portal.gc.HasFunction("Product/Add");
                btnEqual_Click(null, null);
            }

            this.txtName.Focus();
        }
Example #25
0
        public override bool CheckInput()
        {
            bool result = true;//默认是可以通过

            #region MyRegion
            if (txtID.Text.Trim().Length == 0)
            {
                MessageDxUtil.ShowWarning(Const.MsgCheckInput + lblID.Text.Replace(Const.MsgCheckSign, string.Empty));
                this.txtID.Focus();
                result = false;
            }

            if (txtName.Text.Trim().Length == 0)
            {
                MessageDxUtil.ShowWarning(Const.MsgCheckInput + lblName.Text.Replace(Const.MsgCheckSign, string.Empty));
                txtName.Focus();
                result = false;
            }

            if (txtSeq.Text.Trim().Length == 0)
            {
                MessageDxUtil.ShowWarning(Const.MsgCheckInput + lblSeq.Text.Replace(Const.MsgCheckSign, string.Empty));
                txtSeq.Focus();
                result = false;
            }

            if (txtParent.Text.Trim().Length == 0)
            {
                MessageDxUtil.ShowWarning(Const.MsgCheckInput + lblParent.Text.Replace(Const.MsgCheckSign, string.Empty));
                txtParent.Focus();
                result = false;
            }

            string Id = txtID.Text;
            if (result)
            {
                if (!ValidateUtil.IsNumeric(Id))
                {
                    MessageDxUtil.ShowWarning(txtID.Text.Replace(Const.MsgCheckSign, string.Empty) + Const.MsgErrFormatByNum);
                    txtID.Focus();
                    result = false;
                }
            }


            if (result && string.IsNullOrEmpty(ID))
            {
                Int32        NumId        = Convert.ToInt32(Id);
                DictTypeInfo dictTypeInfo = BLLFactory <DictType> .Instance.FindByID(NumId);

                if (dictTypeInfo != null)
                {
                    MessageDxUtil.ShowTips(string.Format("已存在类别编号[{0}],类别名称[{1}]", dictTypeInfo.ID, dictTypeInfo.Name));
                    txtID.Focus();
                    result = false;
                }
            }

            #endregion

            return(result);
        }