private void bindStatus()
 {
     List<Status> lst = new List<Status>();
     lst.Add(new Status { val = 0, text="Tạo mới"});
     lst.Add(new Status { val = 1, text = "Kích hoạt" });
     lst.Add(new Status { val = 2, text = "Nâng cấp" });
     lst.Add(new Status { val = 3, text = "Tất toán" });
     lst.Add(new Status { val = 4, text = "Hết hạn" });
     ddlStatus.DataSource = lst;
     ddlStatus.DataTextField = "text";
     ddlStatus.DataValueField = "val";
     ddlStatus.DataBind();
 }
Beispiel #2
0
 private void bindStatusMember()
 {
     List<Status> lst = new List<Status>();
     lst.Add(new Status{val =-1, text = "All"});
     lst.Add(new Status { val = 0, text = "Tạo mới" });
     lst.Add(new Status { val = 1, text = "Kích hoạt" });
     lst.Add(new Status { val = 2, text = "Ngưng kích hoạt" });
     ddlStatusMember.DataSource = lst;
     ddlStatusMember.DataValueField = "val";
     ddlStatusMember.DataTextField = "text";
     ddlStatusMember.DataBind();
 }
Beispiel #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (_MemberID <= 0)
            {
                JscriptMsg("Lỗi xảy ra: " + "Không lấy được thông tin thành viên", "", "Error");
                return;
            }

            string _ApproveBy = string.Empty;

            if (Utils.GetCookie(PTSKeys.ADMIN_NAME, PTSKeys.CDL_CMS_KEY) != null)
            {
                _ApproveBy = Utils.GetCookie(PTSKeys.ADMIN_NAME, PTSKeys.CDL_CMS_KEY);

            }

            int _UsePackageID = int.Parse(txtUsePackageID.Text.Trim());

            int _StatusPackage = int.Parse(ddlStatusPackage.SelectedValue.ToString());

            int _StatusMember = int.Parse(ddlStatusMember.SelectedValue.ToString());

            int _error_code = 0;

            if (_UsePackageID == 0) {

                JscriptMsg("Thành viên chưa sử dụng gói dịch vụ nào", "", "Success");
                return;
            }

            bll.Member_UsePackage_Process(_MemberID,_UsePackageID,_StatusPackage,_StatusMember, _ApproveBy, ref _error_code);

            //kich hoat tai khoan
            if (_StatusPackage == 1) {

                DataTable dt = bll.Member_Email_Active_Package(_UsePackageID);

                string templateDir = HttpContext.Current.Server.MapPath("/Tools/Mail");
                string templateName = "package_active.html";

                INVelocityEngine fileEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(templateDir, true);

                //DataTable dtmem = bll.MEMBER_EMAIL_ACTIVE_PACKAGE((long)_UsePackageID);

                IDictionary dic = new Hashtable();
                dic.Add("SEND_DATE",DateTime.Now.ToString("dd/MM/yyyy"));
                dic.Add("MEMBER_NAME", dt.Rows[0]["MemberName"].ToString());
                dic.Add("MEMBER_ID", _MemberID.ToString());
                dic.Add("PACKAGE_NAME", dt.Rows[0]["PackageName"].ToString());
                dic.Add("PACKAGE_VALUE", dt.Rows[0]["PackageValue"].ToString());

                dic.Add("EXTEND_COUNT", dt.Rows[0]["MaxTryOrder"].ToString());
                dic.Add("MAXBOOK_AMOUNT", dt.Rows[0]["MaxBorrowBook"].ToString());
                dic.Add("EXPIRED_DATE", dt.Rows[0]["ExpiredDate"].ToString());
                dic.Add("EMAIL", dt.Rows[0]["Email"].ToString());

                dic.Add("PASSWORD",  DESEncrypt.Decrypt(dt.Rows[0]["Password"].ToString()));

                Model.EmailOut eo = new Model.EmailOut();
                eo.EmailSubject = "Thông báo kích hoạt tài khoản";
                eo.EmailBody = fileEngine.Process(dic, templateName);
                eo.EmailTo = dt.Rows[0]["Email"].ToString();
                List<Model.EmailOut> lst = new List<Model.EmailOut>();
                lst.Add(eo);
                EMailAsync.Instance.PushEMail(lst, 0, _ApproveBy);

                //string MailSubject = "Bảng báo giá chi tiết";
                //string mailBody = fileEngine.Process(dic, templateName);
                //Mail.send(MailSubject, custom_email, mailBody);
            }

            if (_error_code == 0)
            {
                JscriptMsg("Cập nhật thành công !", "", "Success");
            }
            else
            {
                JscriptMsg("Lỗi xảy ra: " + _error_code.ToString(), "", "Error");
            }
        }