Beispiel #1
0
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            lblMessage.Text = string.Empty;
            if (string.IsNullOrEmpty(txtCIF.Text))
            {
                lblMessage.Text = "Nhập mã khách hàng";
                txtCIF.Focus();
                return;
            }
            if (string.IsNullOrEmpty(hdfCIF.Value))
            {
                lblMessage.Text = "Mã khách hàng không hợp lệ";
                txtCIF.Focus();
                return;
            }

            using (Promotion.DataModel.LiXi_BO objLiXi_BO = new Promotion.DataModel.LiXi_BO())
            {
                Promotion.DataModel.LiXi objLiXi = objLiXi_BO.GetByCIF(hdfCIF.Value);
                if (objLiXi != null)
                {
                    objLiXi.IsUsed    = false;
                    objLiXi.Deleted   = DateTime.Now;
                    objLiXi.DeletedBy = Session[Promotion.Commons.Constant.USERNAME].ToString();
                    bool result = objLiXi_BO.UpdateLiXi(objLiXi);
                    if (result)
                    {
                        cmdDelete.Visible = false;
                        lblMessage.Text   = "Xóa cấp lì xì thành công.";
                    }
                    else
                    {
                        lblMessage.Text = "Có lỗi khi xóa cấp lì xì.";
                    }
                }
                else
                {
                    lblMessage.Text = "Dữ liệu không hợp lệ";
                }
            }
        }
Beispiel #2
0
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            lblMessage.Text = string.Empty;
            if (string.IsNullOrEmpty(txtCIF.Text))
            {
                lblMessage.Text = "Nhập mã khách hàng";
                txtCIF.Focus();
                return;
            }
            if (string.IsNullOrEmpty(hdfCIF.Value))
            {
                lblMessage.Text = "Mã khách hàng không hợp lệ";
                txtCIF.Focus();
                return;
            }

            using (Promotion.DataModel.LiXi_BO objLiXi_BO = new Promotion.DataModel.LiXi_BO())
            {
                Promotion.DataModel.LiXi objLiXi = objLiXi_BO.GetByCIF(hdfCIF.Value);
                if (objLiXi != null)
                {
                    objLiXi.IsUsed = false;
                    objLiXi.Deleted = DateTime.Now;
                    objLiXi.DeletedBy = Session[Promotion.Commons.Constant.USERNAME].ToString();
                    bool result = objLiXi_BO.UpdateLiXi(objLiXi);
                    if (result)
                    {
                        cmdDelete.Visible = false;
                        lblMessage.Text = "Xóa cấp lì xì thành công.";
                    }
                    else
                    {
                        lblMessage.Text = "Có lỗi khi xóa cấp lì xì.";
                    }
                }
                else
                {
                    lblMessage.Text = "Dữ liệu không hợp lệ";
                }
            }
        }