예제 #1
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            WorkPlaceBLL bll = new WorkPlaceBLL();

            if (Status == "new")
            {
                bool exists = bll.IsExists(txtPlaceCode.Text.Trim());   //判断是否存在
                if (exists)
                {
                    ExecAlertScritp("该编码已存在");
                    return;
                }
            }

            string Id = ID;

            if (string.IsNullOrEmpty(Id))
            {
                Id = Guid.NewGuid().ToString();
            }

            bool ret = bll.AddEditWorkPlace(Id, txtPlaceName.Text.Trim(), txtPlaceCode.Text.Trim());

            if (ret)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>AlertAndNewLoad('添加或编辑成功');</script>");
            }
            else
            {
                ExecAlertScritp("添加失败,请联系管理员");
            }
        }
예제 #2
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void Bind()
        {
            WorkPlaceBLL bll = new WorkPlaceBLL();

            gvWorkPlace.DataSource = bll.GetWorkPlace();
            gvWorkPlace.DataBind();
        }
예제 #3
0
        private void Bind()
        {
            WorkPlaceBLL  bll  = new WorkPlaceBLL();
            WorkPlaceInfo info = bll.GetWorkPlaceByID(ID);

            if (info != null)
            {
                txtPlaceName.Text = info.PlaceName;
                txtPlaceCode.Text = info.PlaceCode;
            }

            if (Status == "view")
            {
                txtPlaceCode.Enabled = false;
                txtPlaceName.Enabled = false;
                ibtAdd.Enabled       = false;
            }
        }