예제 #1
0
        protected void bt_AddCate_Click(object sender, EventArgs e)
        {
            lb_Error.Text = "";
            try
            {
                CY.GFive.Core.Business.ParentCode pct = CY.GFive.Core.Business.ParentCode.GetInstance("RoomState");
                if (pct == null)
                {
                    ParentCode pc = new ParentCode();
                    pc.Des = "寝室状态";
                    pc.PCateCode = "RoomState";
                    pc.PName = "RoomState";
                    pc.Save();
                }
                CateCode ncc = new CateCode();
                ncc.Code = tb_CateCode.Text;
                ncc.CateName = tb_CateName.Text.Trim();
                ncc.CateDes = tb_CateName.Text;
                ncc.ParentCode = "RoomState";
                ncc.Save();

                tb_CateCode.Text = "";
                tb_CateName.Text = "";
                BindddlRoomState();
            }
            catch (Exception ex)
            {
                lb_Error.Text = "错误:" + ex.Message;
            }
        }
예제 #2
0
        //添加记录类型
        protected void btn_AddRcdCate_Click(object sender, EventArgs e)
        {
            lab_Error.Text = "";
            try
            {
                CY.GFive.Core.Business.ParentCode pctemp = CY.GFive.Core.Business.ParentCode.GetInstance("RoomRcdCate");
                if (pctemp == null)
                {
                    ParentCode pc = new ParentCode();
                    pc.Des = "寝室记录类型";
                    pc.PCateCode = "RoomRcdCate";
                    pc.PName = "RoomRcdCate";
                    pc.Save();
                }
                CateCode cc = new CateCode();
                //备注:RRC为RoomRcdCate简写
                cc.CateDes =txt_name.Text.Trim();
                cc.CateName =txt_name.Text.Trim();
                cc.Code ="RRC"+txt_code.Text.Trim();
                cc.ParentCode = "RoomRcdCate";
                bool temp = CateCode.IsExist(cc.Code);
                if (temp)
                {
                    Page.ClientScript.RegisterStartupScript(typeof(string), "", "alert('编号已存在');", true);
                    return;
                }
                cc.Save();

                txt_code.Text = "";
                txt_name.Text = "";
                BindRcdCate();
            }
            catch (Exception ex)
            {
                lab_Error.Text = "错误:" + ex.Message;
            }
        }