Beispiel #1
0
        protected void cmdAgree_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(cboBranch.SelectedItem.Value))
            {
                lblMessage.Text = "Chọn chi nhánh";
                cboBranch.Focus();
                return;
            }

            if ((DateTime.Now < dtStartLiXi) || (DateTime.Now > dtEndLiXi))
            {
                lblMessage.Text = "Chương trình khuyến mại đã kết thúc";
                return;
            }

            using (DataModel.LiXi_BO objLiXi_BO = new DataModel.LiXi_BO())
            {
                DataModel.LiXi objLiXi = new DataModel.LiXi();
                objLiXi.AccountNumber = lblAccountNumber.Text;
                objLiXi.Address = lblAddress.Text;
                objLiXi.CIF = txtCIF.Text.Trim();
                objLiXi.CMND = lblCMND.Text;
                objLiXi.CoCode = cboBranch.SelectedItem.Value;
                objLiXi.Created = DateTime.Now;
                objLiXi.CreatedBy = Session[Constant.USERNAME].ToString();
                objLiXi.CustomerName = lblCustomerName.Text;
                objLiXi.DAO_CODE = Session[Constant.DAO_CODE].ToString();
                objLiXi.DEPT_CODE = Session[Constant.DEPT_CODE].ToString();
                objLiXi.IsUsed = true;
                objLiXi.Telephone = lblTelephone.Text;
                bool result = objLiXi_BO.CreateLiXi(objLiXi);
                if (result)
                {
                    lblMessage.Text = "Cấp Lì xì cho khách hàng thành công";
                    cmdAgree.Visible = false;
                }
                else
                {
                    lblMessage.Text = "Có lỗi khi Cấp Lì xì cho khách hàng";
                }
            }
        }
Beispiel #2
0
        protected void cmdAgree_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(cboBranch.SelectedItem.Value))
            {
                lblMessage.Text = "Chọn chi nhánh";
                cboBranch.Focus();
                return;
            }

            if ((DateTime.Now < dtStartLiXi) || (DateTime.Now > dtEndLiXi))
            {
                lblMessage.Text = "Chương trình khuyến mại đã kết thúc";
                return;
            }

            using (DataModel.LiXi_BO objLiXi_BO = new DataModel.LiXi_BO())
            {
                DataModel.LiXi objLiXi = new DataModel.LiXi();
                objLiXi.AccountNumber = lblAccountNumber.Text;
                objLiXi.Address       = lblAddress.Text;
                objLiXi.CIF           = txtCIF.Text.Trim();
                objLiXi.CMND          = lblCMND.Text;
                objLiXi.CoCode        = cboBranch.SelectedItem.Value;
                objLiXi.Created       = DateTime.Now;
                objLiXi.CreatedBy     = Session[Constant.USERNAME].ToString();
                objLiXi.CustomerName  = lblCustomerName.Text;
                objLiXi.DAO_CODE      = Session[Constant.DAO_CODE].ToString();
                objLiXi.DEPT_CODE     = Session[Constant.DEPT_CODE].ToString();
                objLiXi.IsUsed        = true;
                objLiXi.Telephone     = lblTelephone.Text;
                bool result = objLiXi_BO.CreateLiXi(objLiXi);
                if (result)
                {
                    lblMessage.Text  = "Cấp Lì xì cho khách hàng thành công";
                    cmdAgree.Visible = false;
                }
                else
                {
                    lblMessage.Text = "Có lỗi khi Cấp Lì xì cho khách hàng";
                }
            }
        }
Beispiel #3
0
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            lblMessage.Text = string.Empty;

            lblCIF.Text           = string.Empty;
            lblCustomerName.Text  = string.Empty;
            lblCMND.Text          = string.Empty;
            lblTelephone.Text     = string.Empty;
            lblAddress.Text       = string.Empty;
            lblAccountNumber.Text = string.Empty;
            lblStatus.Text        = string.Empty;

            if (string.IsNullOrEmpty(txtCIF.Text))
            {
                lblMessage.Text = "Nhập mã khách hàng";
                txtCIF.Focus();
                return;
            }

            if (Session[Constant.USERNAME] != null)
            {
                using (PromotionEntities db = new PromotionEntities())
                {
                    var cust = db.CUSTOMERs.FirstOrDefault(t => t.CUSTOMER_CODE.Equals(txtCIF.Text));
                    if (cust != null)
                    {
                        lblCIF.Text          = cust.CUSTOMER_CODE;
                        lblCustomerName.Text = cust.CUSTOMER_NAME;
                        lblCMND.Text         = cust.LEGAL_ID;
                        if (!string.IsNullOrEmpty(cust.TELEPHONE))
                        {
                            lblTelephone.Text = cust.TELEPHONE;
                        }
                        if (!string.IsNullOrEmpty(cust.ADDRESS))
                        {
                            lblAddress.Text = cust.ADDRESS;
                        }
                        string strAccount = string.Empty;

                        var listAcc = db.AZ_ACCOUNT.Where(t => t.CUSTOMER_ID.Equals(txtCIF.Text.Trim())).ToList();
                        if (listAcc != null)
                        {
                            foreach (var azAccount in listAcc)
                            {
                                //strAccount += azAccount.ACCOUNT_NUMBER + "; ";
                            }
                        }

                        lblAccountNumber.Text = strAccount;
                        hdfCIF.Value          = txtCIF.Text.Trim();
                        using (DataModel.LiXi_BO objLiXi_BO = new DataModel.LiXi_BO())
                        {
                            DataModel.LiXi objLiXi = objLiXi_BO.GetByCIF(txtCIF.Text);
                            if (objLiXi != null)
                            {
                                string strPGD = string.Empty;
                                using (DataModel.COMPANY_BO objT24_COMPANY_BO = new DataModel.COMPANY_BO())
                                {
                                    DataModel.COMPANY objT24_COMPANY = objT24_COMPANY_BO.GetByCOMPANY_CODE(objLiXi.CoCode);
                                    if (objT24_COMPANY != null)
                                    {
                                        strPGD = objT24_COMPANY.COMPANY_NAME;
                                    }
                                }
                                lblStatus.Text    = "Đã được cấp Lì xì vào " + objLiXi.Created.Value.ToString("dd/MM/yyyy HH:mm") + " tại " + strPGD + ". Cấp bởi " + objLiXi.CreatedBy;
                                cmdDelete.Visible = true;
                            }
                            else
                            {
                                lblStatus.Text = "Khách hàng chưa được cấp Lì xì";
                            }
                        }
                    }
                    else
                    {
                        lblMessage.Text = "Thông tin khách hàng không phù hợp. ";
                    }
                }
            }
        }
Beispiel #4
0
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            lblMessage.Text = string.Empty;

            lblCIF.Text           = string.Empty;
            lblCustomerName.Text  = string.Empty;
            lblCMND.Text          = string.Empty;
            lblTelephone.Text     = string.Empty;
            lblAddress.Text       = string.Empty;
            lblAccountNumber.Text = string.Empty;
            lblAmount.Text        = string.Empty;

            if (string.IsNullOrEmpty(txtCIF.Text))
            {
                lblMessage.Text = "Nhập mã khách hàng";
                txtCIF.Focus();
                return;
            }

            if (string.IsNullOrEmpty(cboBranch.SelectedItem.Value))
            {
                lblMessage.Text = "Chọn chi nhánh";
                cboBranch.Focus();
                return;
            }
            bool bValidate = false;

            using (PromotionEntities db = new PromotionEntities())
            {
                var cust = db.CUSTOMERs.FirstOrDefault(t => t.CUSTOMER_CODE.Equals(txtCIF.Text));
                if (cust != null)
                {
                    lblCIF.Text          = cust.CUSTOMER_CODE;
                    lblCustomerName.Text = cust.CUSTOMER_NAME;
                    lblCMND.Text         = cust.LEGAL_ID;
                    if (!string.IsNullOrEmpty(cust.TELEPHONE))
                    {
                        lblTelephone.Text = cust.TELEPHONE;
                    }
                    if (!string.IsNullOrEmpty(cust.ADDRESS))
                    {
                        lblAddress.Text = cust.ADDRESS;
                    }
                    string strAccount = string.Empty;

                    var listAcc = db.AZ_ACCOUNT.Where(t => t.CUSTOMER_ID.Equals(txtCIF.Text.Trim())).ToList();
                    if (listAcc != null)
                    {
                        foreach (var azAccount in listAcc)
                        {
                            //strAccount += azAccount.ACCOUNT_NUMBER + "; ";
                        }
                    }

                    bValidate             = true;
                    lblAccountNumber.Text = strAccount;
                }
                else
                {
                    lblMessage.Text = "Thông tin khách hàng không phù hợp. ";
                }
            }

            if (bValidate)
            {
                using (DataModel.BLACKLIST_CUSTOMER_BO objBLACKLIST_CUSTOMER_BO = new DataModel.BLACKLIST_CUSTOMER_BO())
                {
                    DataModel.BLACKLIST_CUSTOMER objBLACKLIST_CUSTOMER = objBLACKLIST_CUSTOMER_BO.GetByCUSTOMER_ID(txtCIF.Text);
                    if (objBLACKLIST_CUSTOMER != null)
                    {
                        lblMessage.Text = "Yêu cầu cấp lì xì không hợp lệ. Khách hàng thuộc danh sách cán bộ, nhân viên GPBank. Đề nghị kiểm tra lại thông tin.";
                        bValidate       = false;
                    }
                }
            }

            if (bValidate)
            {
                using (DataModel.LiXi_BO objLiXi_BO = new DataModel.LiXi_BO())
                {
                    DataModel.LiXi objLiXi = objLiXi_BO.GetByCIF(txtCIF.Text);
                    if (objLiXi != null)
                    {
                        string strPGD = string.Empty;
                        using (DataModel.COMPANY_BO objT24_COMPANY_BO = new DataModel.COMPANY_BO())
                        {
                            DataModel.COMPANY objT24_COMPANY = objT24_COMPANY_BO.GetByCOMPANY_CODE(objLiXi.CoCode);
                            if (objT24_COMPANY != null)
                            {
                                strPGD = objT24_COMPANY.COMPANY_NAME;
                            }
                        }
                        lblMessage.Text = "Khách hàng " + lblCustomerName.Text + " đã được cấp Lì xì vào " + objLiXi.Created.Value.ToString("dd/MM/yyyy HH:mm") + " tại " + strPGD + ". Đề nghị kiểm tra lại thông tin.";
                        bValidate       = false;
                    }
                    else
                    {
                        DateTime dtNow  = DateTime.Now;
                        DateTime dtFrom = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, 0, 0, 1);
                        DateTime dtTo   = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, 23, 59, 59);
                        List <DataModel.LiXi> lstData = objLiXi_BO.GetByCoCode(cboBranch.SelectedItem.Value, dtFrom, dtTo).ToList();
                        if (lstData != null)
                        {
                            lstData        = lstData.Where(o => !o.IsUsed.HasValue || (o.IsUsed.HasValue && o.IsUsed.Value)).ToList();
                            lblAmount.Text = lstData.Count.ToString();
                            if (lstData.Count < MAX_LIXI)
                            {
                                bValidate = true;
                            }
                            else
                            {
                                bValidate       = false;
                                lblMessage.Text = "Yêu cầu cấp Lì xì không hợp lệ. Điểm giao dịch đã cấp đủ số lượng (" + MAX_LIXI.ToString() + ") Lì xì trong ngày. Đề nghị kiểm tra lại thông tin.";
                            }
                        }
                    }
                }
            }

            if (bValidate)
            {
                cmdAgree.Visible = true;
            }
        }
Beispiel #5
0
        private void BindData()
        {
            try
            {
                if (string.IsNullOrEmpty(txtFrom.Text))
                {
                    lblMessage.Text = "Nhập ngày bắt đầu báo cáo";
                    txtFrom.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(txtTo.Text))
                {
                    lblMessage.Text = "Nhập ngày kết thúc báo cáo";
                    txtTo.Focus();
                    return;
                }


                DateTime dtFrom = new DateTime();
                DateTime dtTo   = new DateTime();
                string[] arr    = null;
                int      day    = -1;
                int      month  = -1;
                int      year   = -1;
                if (!string.IsNullOrEmpty(txtFrom.Text))
                {
                    arr = txtFrom.Text.Trim().Split('/');
                    if (arr != null && arr.Length > 2)
                    {
                        int.TryParse(arr[0], out day);
                        int.TryParse(arr[1], out month);
                        int.TryParse(arr[2], out year);
                        if (day > 0 && month > 0 && year > 0)
                        {
                            dtFrom = new DateTime(year, month, day, 0, 0, 1);
                        }
                    }
                }

                if (!string.IsNullOrEmpty(txtTo.Text))
                {
                    arr = txtTo.Text.Trim().Split('/');
                    if (arr != null && arr.Length > 2)
                    {
                        int.TryParse(arr[0], out day);
                        int.TryParse(arr[1], out month);
                        int.TryParse(arr[2], out year);
                        if (day > 0 && month > 0 && year > 0)
                        {
                            dtTo = new DateTime(year, month, day, 23, 59, 59);
                        }
                    }
                }

                using (DataModel.LiXi_BO objLiXi_BO = new DataModel.LiXi_BO())
                {
                    List <DataModel.LiXi> lstData = objLiXi_BO.GetByCoCode(cboBranch.SelectedItem.Value, dtFrom, dtTo).ToList();
                    dxgvLiXi.DataSource = lstData;
                    dxgvLiXi.DataBind();
                }
            }
            catch (Exception ex)
            {
                log.Fatal(ex);
            }
        }
Beispiel #6
0
        private void BindData()
        {
            try
            {
                if (string.IsNullOrEmpty(txtFrom.Text))
                {
                    lblMessage.Text = "Nhập ngày bắt đầu báo cáo";
                    txtFrom.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(txtTo.Text))
                {
                    lblMessage.Text = "Nhập ngày kết thúc báo cáo";
                    txtTo.Focus();
                    return;
                }


                DateTime dtFrom = new DateTime();
                DateTime dtTo = new DateTime();
                string[] arr = null;
                int day = -1;
                int month = -1;
                int year = -1;
                if (!string.IsNullOrEmpty(txtFrom.Text))
                {
                    arr = txtFrom.Text.Trim().Split('/');
                    if (arr != null && arr.Length > 2)
                    {
                        int.TryParse(arr[0], out day);
                        int.TryParse(arr[1], out month);
                        int.TryParse(arr[2], out year);
                        if (day > 0 && month > 0 && year > 0)
                        {
                            dtFrom = new DateTime(year, month, day, 0, 0, 1);
                        }
                    }
                }

                if (!string.IsNullOrEmpty(txtTo.Text))
                {
                    arr = txtTo.Text.Trim().Split('/');
                    if (arr != null && arr.Length > 2)
                    {
                        int.TryParse(arr[0], out day);
                        int.TryParse(arr[1], out month);
                        int.TryParse(arr[2], out year);
                        if (day > 0 && month > 0 && year > 0)
                        {
                            dtTo = new DateTime(year, month, day, 23, 59, 59);
                        }
                    }
                }

                using (DataModel.LiXi_BO objLiXi_BO = new DataModel.LiXi_BO())
                {
                    List<DataModel.LiXi> lstData = objLiXi_BO.GetByCoCode(cboBranch.SelectedItem.Value, dtFrom, dtTo).ToList();
                    dxgvLiXi.DataSource = lstData;
                    dxgvLiXi.DataBind();
                }
            }
            catch (Exception ex)
            {
                log.Fatal(ex);
            }
        }
Beispiel #7
0
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            lblMessage.Text = string.Empty;

            lblCIF.Text           = string.Empty;
            lblCustomerName.Text  = string.Empty;
            lblCMND.Text          = string.Empty;
            lblTelephone.Text     = string.Empty;
            lblAddress.Text       = string.Empty;
            lblAccountNumber.Text = string.Empty;
            lblAmount.Text        = string.Empty;

            if (string.IsNullOrEmpty(txtCIF.Text))
            {
                lblMessage.Text = "Nhập mã khách hàng";
                txtCIF.Focus();
                return;
            }

            if (string.IsNullOrEmpty(cboBranch.SelectedItem.Value))
            {
                lblMessage.Text = "Chọn chi nhánh";
                cboBranch.Focus();
                return;
            }
            bool bValidate = false;

            //using (eCS.IeCSAdminClient client = new eCS.IeCSAdminClient())
            //{
            //    bool result = true;
            //    string response = string.Empty;
            //    eCS.EBankingCustomerInformation objEBankingCustomerInformation = client.GetCustomerInformation(txtCIF.Text, ref result, ref response);
            //    if (result && objEBankingCustomerInformation != null)
            //    {
            //        lblCIF.Text = objEBankingCustomerInformation.CustomerID;
            //        lblCustomerName.Text = objEBankingCustomerInformation.VNCustomerName;
            //        lblCMND.Text = objEBankingCustomerInformation.LegalID;
            //        if (!string.IsNullOrEmpty(objEBankingCustomerInformation.Telephone))
            //        {
            //            lblTelephone.Text = objEBankingCustomerInformation.Telephone;
            //        }
            //        else
            //        {
            //            lblTelephone.Text = objEBankingCustomerInformation.SMSNumber.Replace("#", " ");
            //        }
            //        lblAddress.Text = objEBankingCustomerInformation.Address.Replace("ý", " ");
            //        string strAccount = string.Empty;
            //        using (eCS.IeCSClient objIeCSClient = new eCS.IeCSClient())
            //        {
            //            DataSet ds = objIeCSClient.GetAccount(txtCIF.Text.Trim(), ref result, ref response);
            //            if (result && ds != null && ds.Tables.Count > 0)
            //            {
            //                foreach (DataRow item in ds.Tables[0].Rows)
            //                {
            //                    strAccount += item["ACCOUNT_NUMBER"].ToString() + "; ";
            //                }
            //            }
            //        }
            //        bValidate = true;
            //        lblAccountNumber.Text = strAccount;
            //    }
            //    else
            //    {
            //        lblMessage.Text = "Thông tin khách hàng không phù hợp. " + response;
            //    }
            //}

            if (bValidate)
            {
                using (DataModel.BLACKLIST_CUSTOMER_BO objBLACKLIST_CUSTOMER_BO = new DataModel.BLACKLIST_CUSTOMER_BO())
                {
                    DataModel.BLACKLIST_CUSTOMER objBLACKLIST_CUSTOMER = objBLACKLIST_CUSTOMER_BO.GetByCUSTOMER_ID(txtCIF.Text);
                    if (objBLACKLIST_CUSTOMER != null)
                    {
                        lblMessage.Text = "Yêu cầu cấp lì xì không hợp lệ. Khách hàng thuộc danh sách cán bộ, nhân viên GPBank. Đề nghị kiểm tra lại thông tin.";
                        bValidate       = false;
                    }
                }
            }

            if (bValidate)
            {
                using (DataModel.LiXi_BO objLiXi_BO = new DataModel.LiXi_BO())
                {
                    DataModel.LiXi objLiXi = objLiXi_BO.GetByCIF(txtCIF.Text);
                    if (objLiXi != null)
                    {
                        string strPGD = string.Empty;
                        using (DataModel.COMPANY_BO objT24_COMPANY_BO = new DataModel.COMPANY_BO())
                        {
                            DataModel.COMPANY objT24_COMPANY = objT24_COMPANY_BO.GetByCOMPANY_CODE(objLiXi.CoCode);
                            if (objT24_COMPANY != null)
                            {
                                strPGD = objT24_COMPANY.COMPANY_NAME;
                            }
                        }
                        lblMessage.Text = "Khách hàng " + lblCustomerName.Text + " đã được cấp Lì xì vào " + objLiXi.Created.Value.ToString("dd/MM/yyyy HH:mm") + " tại " + strPGD + ". Đề nghị kiểm tra lại thông tin.";
                        bValidate       = false;
                    }
                    else
                    {
                        DateTime dtNow  = DateTime.Now;
                        DateTime dtFrom = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, 0, 0, 1);
                        DateTime dtTo   = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, 23, 59, 59);
                        List <DataModel.LiXi> lstData = objLiXi_BO.GetByCoCode(cboBranch.SelectedItem.Value, dtFrom, dtTo).ToList();
                        if (lstData != null)
                        {
                            lstData        = lstData.Where(o => !o.IsUsed.HasValue || (o.IsUsed.HasValue && o.IsUsed.Value)).ToList();
                            lblAmount.Text = lstData.Count.ToString();
                            if (lstData.Count < MAX_LIXI)
                            {
                                bValidate = true;
                            }
                            else
                            {
                                bValidate       = false;
                                lblMessage.Text = "Yêu cầu cấp Lì xì không hợp lệ. Điểm giao dịch đã cấp đủ số lượng (" + MAX_LIXI.ToString() + ") Lì xì trong ngày. Đề nghị kiểm tra lại thông tin.";
                            }
                        }
                    }
                }
            }

            if (bValidate)
            {
                cmdAgree.Visible = true;
            }
        }
Beispiel #8
0
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            lblMessage.Text = string.Empty;

            lblCIF.Text = string.Empty;
            lblCustomerName.Text = string.Empty;
            lblCMND.Text = string.Empty;
            lblTelephone.Text = string.Empty;
            lblAddress.Text = string.Empty;
            lblAccountNumber.Text = string.Empty;
            lblStatus.Text = string.Empty;

            if (string.IsNullOrEmpty(txtCIF.Text))
            {
                lblMessage.Text = "Nhập mã khách hàng";
                txtCIF.Focus();
                return;
            }

            if (Session[Constant.USERNAME] != null)
            {
                using (PromotionEntities db = new PromotionEntities())
                {
                    var cust = db.CUSTOMERs.FirstOrDefault(t => t.CUSTOMER_CODE.Equals(txtCIF.Text));
                    if (cust != null)
                    {
                        lblCIF.Text = cust.CUSTOMER_CODE;
                        lblCustomerName.Text = cust.CUSTOMER_NAME;
                        lblCMND.Text = cust.LEGAL_ID;
                        if (!string.IsNullOrEmpty(cust.TELEPHONE))
                        {
                            lblTelephone.Text = cust.TELEPHONE;
                        }
                        if (!string.IsNullOrEmpty(cust.ADDRESS))
                        {
                            lblAddress.Text = cust.ADDRESS;
                        }
                        string strAccount = string.Empty;

                        var listAcc = db.AZ_ACCOUNT.Where(t => t.CUSTOMER_ID.Equals(txtCIF.Text.Trim())).ToList();
                        if (listAcc != null)
                        {
                            foreach (var azAccount in listAcc)
                            {
                                //strAccount += azAccount.ACCOUNT_NUMBER + "; ";
                            }
                        }

                        lblAccountNumber.Text = strAccount;
                        hdfCIF.Value = txtCIF.Text.Trim();
                        using (DataModel.LiXi_BO objLiXi_BO = new DataModel.LiXi_BO())
                        {
                            DataModel.LiXi objLiXi = objLiXi_BO.GetByCIF(txtCIF.Text);
                            if (objLiXi != null)
                            {
                                string strPGD = string.Empty;
                                using (DataModel.COMPANY_BO objT24_COMPANY_BO = new DataModel.COMPANY_BO())
                                {
                                    DataModel.COMPANY objT24_COMPANY = objT24_COMPANY_BO.GetByCOMPANY_CODE(objLiXi.CoCode);
                                    if (objT24_COMPANY != null)
                                    {
                                        strPGD = objT24_COMPANY.COMPANY_NAME;
                                    }
                                }
                                lblStatus.Text = "Đã được cấp Lì xì vào " + objLiXi.Created.Value.ToString("dd/MM/yyyy HH:mm") + " tại " + strPGD + ". Cấp bởi " + objLiXi.CreatedBy;
                                cmdDelete.Visible = true;
                            }
                            else
                            {
                                lblStatus.Text = "Khách hàng chưa được cấp Lì xì";
                            }
                        }
                    }
                    else
                    {
                        lblMessage.Text = "Thông tin khách hàng không phù hợp. ";
                    }
                }
            }
        }
Beispiel #9
0
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            lblMessage.Text = string.Empty;

            lblCIF.Text = string.Empty;
            lblCustomerName.Text = string.Empty;
            lblCMND.Text = string.Empty;
            lblTelephone.Text = string.Empty;
            lblAddress.Text = string.Empty;
            lblAccountNumber.Text = string.Empty;
            lblAmount.Text = string.Empty;

            if (string.IsNullOrEmpty(txtCIF.Text))
            {
                lblMessage.Text = "Nhập mã khách hàng";
                txtCIF.Focus();
                return;
            }

            if (string.IsNullOrEmpty(cboBranch.SelectedItem.Value))
            {
                lblMessage.Text = "Chọn chi nhánh";
                cboBranch.Focus();
                return;
            }
            bool bValidate = false;
            //using (eCS.IeCSAdminClient client = new eCS.IeCSAdminClient())
            //{
            //    bool result = true;
            //    string response = string.Empty;
            //    eCS.EBankingCustomerInformation objEBankingCustomerInformation = client.GetCustomerInformation(txtCIF.Text, ref result, ref response);
            //    if (result && objEBankingCustomerInformation != null)
            //    {
            //        lblCIF.Text = objEBankingCustomerInformation.CustomerID;
            //        lblCustomerName.Text = objEBankingCustomerInformation.VNCustomerName;
            //        lblCMND.Text = objEBankingCustomerInformation.LegalID;
            //        if (!string.IsNullOrEmpty(objEBankingCustomerInformation.Telephone))
            //        {
            //            lblTelephone.Text = objEBankingCustomerInformation.Telephone;
            //        }
            //        else
            //        {
            //            lblTelephone.Text = objEBankingCustomerInformation.SMSNumber.Replace("#", " ");
            //        }
            //        lblAddress.Text = objEBankingCustomerInformation.Address.Replace("ý", " ");
            //        string strAccount = string.Empty;
            //        using (eCS.IeCSClient objIeCSClient = new eCS.IeCSClient())
            //        {
            //            DataSet ds = objIeCSClient.GetAccount(txtCIF.Text.Trim(), ref result, ref response);
            //            if (result && ds != null && ds.Tables.Count > 0)
            //            {
            //                foreach (DataRow item in ds.Tables[0].Rows)
            //                {
            //                    strAccount += item["ACCOUNT_NUMBER"].ToString() + "; ";
            //                }
            //            }
            //        }
            //        bValidate = true;
            //        lblAccountNumber.Text = strAccount;
            //    }
            //    else
            //    {
            //        lblMessage.Text = "Thông tin khách hàng không phù hợp. " + response;
            //    }
            //}

            if (bValidate)
            {
                using (DataModel.BLACKLIST_CUSTOMER_BO objBLACKLIST_CUSTOMER_BO = new DataModel.BLACKLIST_CUSTOMER_BO())
                {
                    DataModel.BLACKLIST_CUSTOMER objBLACKLIST_CUSTOMER = objBLACKLIST_CUSTOMER_BO.GetByCUSTOMER_ID(txtCIF.Text);
                    if (objBLACKLIST_CUSTOMER != null)
                    {
                        lblMessage.Text = "Yêu cầu cấp lì xì không hợp lệ. Khách hàng thuộc danh sách cán bộ, nhân viên GPBank. Đề nghị kiểm tra lại thông tin.";
                        bValidate = false;
                    }
                }
            }

            if (bValidate)
            {
                using (DataModel.LiXi_BO objLiXi_BO = new DataModel.LiXi_BO())
                {
                    DataModel.LiXi objLiXi = objLiXi_BO.GetByCIF(txtCIF.Text);
                    if (objLiXi != null)
                    {
                        string strPGD = string.Empty;
                        using (DataModel.COMPANY_BO objT24_COMPANY_BO = new DataModel.COMPANY_BO())
                        {
                            DataModel.COMPANY objT24_COMPANY = objT24_COMPANY_BO.GetByCOMPANY_CODE(objLiXi.CoCode);
                            if (objT24_COMPANY != null)
                            {
                                strPGD = objT24_COMPANY.COMPANY_NAME;
                            }
                        }
                        lblMessage.Text = "Khách hàng " + lblCustomerName.Text + " đã được cấp Lì xì vào " + objLiXi.Created.Value.ToString("dd/MM/yyyy HH:mm") + " tại " + strPGD + ". Đề nghị kiểm tra lại thông tin.";
                        bValidate = false;
                    }
                    else
                    {
                        DateTime dtNow = DateTime.Now;
                        DateTime dtFrom = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, 0, 0, 1);
                        DateTime dtTo = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day, 23, 59, 59);
                        List<DataModel.LiXi> lstData = objLiXi_BO.GetByCoCode(cboBranch.SelectedItem.Value, dtFrom, dtTo).ToList();
                        if (lstData != null)
                        {
                            lstData = lstData.Where(o => !o.IsUsed.HasValue || (o.IsUsed.HasValue && o.IsUsed.Value)).ToList();
                            lblAmount.Text = lstData.Count.ToString();
                            if (lstData.Count < MAX_LIXI)
                            {
                                bValidate = true;
                            }
                            else
                            {
                                bValidate = false;
                                lblMessage.Text = "Yêu cầu cấp Lì xì không hợp lệ. Điểm giao dịch đã cấp đủ số lượng (" + MAX_LIXI.ToString() + ") Lì xì trong ngày. Đề nghị kiểm tra lại thông tin.";
                            }
                        }
                    }
                }
            }

            if (bValidate)
            {
                cmdAgree.Visible = true;
            }

        }