Example #1
0
        protected override bool BtnOkClick()
        {
            if (string.IsNullOrEmpty(this.d_Kind.Text))
            {
                Miles.Framework.UI.Function.MForm.SetToolTip(this.d_Kind, "名称不能为空", 1000);
                return(false);
            }

            if (string.IsNullOrEmpty(this.d_Value.Text))
            {
                Miles.Framework.UI.Function.MForm.SetToolTip(this.d_Value, "说明不能为空", 1000);
                return(false);
            }

            Model.Tb_enum info = this.GetDataBind <Model.Tb_enum>();

            if (this.blNewFlag)
            {
                info.Item_Flag = 1;

                //判断不重复的类型
                if (manager.ExistsKind(info.Enum_Kind))
                {
                    Miles.Framework.UI.Function.MForm.SetToolTip(this.d_Kind, "已存在类型名称", 1000);
                    return(false);
                }

                if (!manager.Add(info))
                {
                    return(false);
                }
            }
            else
            {
                Model.Tb_enum old = modelObj as Model.Tb_enum;
                info.Item_Flag = 1;

                if (!manager.Update(info, old))
                {
                    return(false);
                }
            }

            this.DoSelectValueEvent(info);

            return(true);
        }
Example #2
0
        protected override bool BtnOkClick()
        {
            if (this.d_Value.Value < 0)
            {
                Miles.Framework.UI.Function.MForm.SetToolTip(this.d_Value, "数值不能为负数", 1000);
                return(false);
            }


            if (string.IsNullOrEmpty(this.d_Text.Text))
            {
                Miles.Framework.UI.Function.MForm.SetToolTip(this.d_Text, "说明不能为空", 1000);
                return(false);
            }



            Model.Tb_enum info = this.GetDataBind <Model.Tb_enum>();

            if (this.blNewFlag)
            {
                info.Item_Id   = 0;
                info.Enum_Kind = this.Tag.ToString();
                if (!manager.Add(info))
                {
                    return(false);
                }
            }
            else
            {
                Model.Tb_enum old = modelObj as Model.Tb_enum;
                info.Item_Id   = 0;
                info.Enum_Kind = this.Tag.ToString();

                if (!manager.Update(info, old))
                {
                    return(false);
                }
            }

            this.DoSelectValueEvent(info);

            return(true);
        }