private void InitCombo() { dtpStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); dtpEnd.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59); try { CustomerDAC dacCustomer = new CustomerDAC(); customer.Items.Clear(); List <CustomerEntity> lstCustomer = dacCustomer.SelectAll(); foreach (CustomerEntity entity in lstCustomer) { customer.Items.Add(entity.customer); } SysDictDAC dacSys = new SysDictDAC(); specifications.Items.Clear(); List <SysDictEntity> lstDict = dacSys.SelectList("deliveryspec"); foreach (SysDictEntity entity in lstDict) { specifications.Items.Add(entity.dictvalue); } goodname.Items.Clear(); lstDict = dacSys.SelectList("goodname"); foreach (SysDictEntity entity in lstDict) { goodname.Items.Add(entity.dictvalue); } } catch (Exception ex) { MessageBox.Show("读取数据库出错,请检查网络;\r\n原因:" + ex.Message); } }
private void SetTitle(Guid providerID) { CustomerDAC dac = new CustomerDAC(); if (dac.IsUserImageExist(providerID)) { divWithImage.Visible = true; divNoImage.Visible = false; int ImageID = new CustomerBFC().getProviderPrimaryImage(providerID); if (ImageID != 0) { ProviderImage.ImageUrl = "~/ImageHandler.ashx?" + SystemConstants.qs_UserImageID + "=" + ImageID; } else { divWithImage.Visible = false; divNoImage.Visible = true; } } else { divWithImage.Visible = false; divNoImage.Visible = true; } }
protected void StepNextButton_Click(object sender, EventArgs e) { bool error = false; validateUser(out error); if (!error) { var token = WebSecurity.CreateUserAndAccount(Username.Text, Password.Text, null, true); // User cannot login as they need to confirm account first.. if (!Roles.RoleExists(SystemConstants.CustomerRole)) { Roles.CreateRole(SystemConstants.CustomerRole); } Roles.AddUserToRole(Username.Text, SystemConstants.CustomerRole); Guid userID = new CustomerDAC().RetrieveUserGUID(Username.Text); if (userID != Guid.Empty) { CreatedUser(userID); } SendConfirmationEmail(userID, token); Registration.Visible = false; completeRegistration.Visible = true; } }
protected void btnGetPasswordToken_Click(object sender, EventArgs e) { var RegEx = @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"; var Match = Regex.Match(txtUsername.Text, RegEx, RegexOptions.IgnoreCase); if (Match.Success) { Guid userID = new CustomerDAC().RetrieveUserGUIDbyEmailAddress(txtUsername.Text); ProcessPasswordRecovery(userID); } else { //Check if username valid if (!WebSecurity.UserExists(txtUsername.Text)) { lblError.Visible = true; lblError.Text = "This username is not registered."; } else { CustomerDAC dac = new CustomerDAC(); Guid userID = new MembershipHelper().GetProviderUserKey(txtUsername.Text); ProcessPasswordRecovery(userID); } } }
protected void Login1_LoggedIn(object sender, EventArgs e) { var dr = new CustomerDAC().RetrieveUserProfiles(new MembershipHelper().GetProviderUserKey(Login1.UserName)); if (dr != null) { Session[SystemConstants.ses_FName] = dr.FirstName; Session[SystemConstants.ses_LName] = dr.LastName; Session[SystemConstants.ses_Role] = SystemConstants.CustomerRole; Session[SystemConstants.ses_Email] = dr.Email; Session[SystemConstants.ses_UserID] = dr.UserID.ToString(); var drr = new CustomerDAC().RetrieveUserRewardDetails(dr.FirstName); if (drr != null) { Session[SystemConstants.ses_Rwdpts] = Convert.ToString(drr.RewardPoint); } } else { var drp = new CustomerDAC().RetrieveProviderProfiles(new MembershipHelper().GetProviderUserKey(Login1.UserName)); if (drp != null) { WebSecurity.Logout(); //Session[SystemConstants.ses_FName] = drp.ProviderName; //Session[SystemConstants.ses_LName] = ""; //Session[SystemConstants.ses_Role] = SystemConstants.ProviderRole; //Session[SystemConstants.ses_Email] = drp.Email; } } Response.Redirect("~/Activities"); }
public static void SaveActivity(CustomerEDSC.ActivityDTRow ActivityDetailDR, CustomerEDSC.ActivityContactDetailDTRow contactDetailsDR, CustomerEDSC.ActivityGroupingDTRow ActGroupingDR, CustomerEDSC.ActivityScheduleDTDataTable ActScheduleDT) { CustomerDAC dac = new CustomerDAC(); using (TransactionScope trans = new TransactionScope()) { int activityID; dac.CreateActivities(ActivityDetailDR, out activityID); //Activity was Created, update all foreign key contactDetailsDR.ActivityID = activityID; ActGroupingDR.ActivityID = activityID; //CreateContactDetails dac.CreateActivityContactDetail(contactDetailsDR); //Create Schedule foreach (var ActScheduleDR in ActScheduleDT) { ActScheduleDR.ActivityID = activityID; dac.CreateActivitySchedule(ActScheduleDR); } //Create Grouping dac.CreateActivityGrouping(ActGroupingDR); trans.Complete(); } }
protected void Refresh() { Guid userId = Guid.Empty; if (WebSecurity.IsAuthenticated) { string fName = null; if (Session[SystemConstants.ses_FName] != null) { fName = (String)(Session[SystemConstants.ses_FName]); } var dr = new CustomerDAC().RetrieveUserRewardDetails(fName); if (dr != null) { RewardPts.Text = Convert.ToString(dr.RewardPoint); Redeempts.Text = Convert.ToString(dr.RedeemedtPoint); Bonuspts.Text = Convert.ToString(dr.BonusPoint); userId = dr.UserID; } } ods.TypeName = typeof(CustomerDAC).FullName; ods.SelectParameters.Clear(); ods.SelectParameters.Add("UserId", Convert.ToString(userId)); ods.SelectMethod = "RetrieveActAttendance"; ods.SelectCountMethod = "RetrieveActAttCount"; ActivityAttView.DataSourceID = "ods"; }
private void InitDict() { try { CustomerDAC dacCustomer = new CustomerDAC(); customer.Items.Clear(); List <CustomerEntity> lstCustomer = dacCustomer.SelectAll(); foreach (CustomerEntity entity in lstCustomer) { customer.Items.Add(entity.customer); } SysDictDAC dacSys = new SysDictDAC(); model.Items.Clear(); List <SysDictEntity> lstDict = dacSys.SelectList("model"); foreach (SysDictEntity entity in lstDict) { model.Items.Add(entity.dictvalue); } goodname.Items.Clear(); lstDict = dacSys.SelectList("goodname"); foreach (SysDictEntity entity in lstDict) { goodname.Items.Add(entity.dictvalue); } } catch (Exception ex) { MessageBox.Show("提取字典出错,请检查网络是否异常!\r\n原因如下:" + ex.Message); } }
protected void btnNextStep_Click(object sender, EventArgs e) { //CustomerEDSC.CartDTRow dr = GetData(); //CustomerEDSC.CartItemDTDataTable dt = new CartHelper(Session).RetrieveCartItem(); //CustomerEDSC.CartItemDTDataTable dt = new CustomerEDSC.CartItemDTDataTable(); //new CustomerDAC().CreateCart(dr, dt); //Session["OrderID"] = dr.ID; CustomerEDSC.WebConfigurationDTRow drSmtp = new CustomerDAC().RetrieveEmailServerSetting(); if (drSmtp != null) { //SendEmail to HelpDesk string emailBody = "This email was sent from Healthy Club Notification System to Healthy Club Help Desk.<br/><p> New query from " + txtContactPerson.Text + "<br /> "; emailBody += " Query Information</p><table><tr><td> </td> <td > Contact Person </td> <td> : </td> <td> " + txtContactPerson.Text + "</td>"; emailBody += "</tr> <tr> <td> </td> <td> Contact Number </td> <td> : </td> <td> " + txtPhone.Text + "</td>"; emailBody += "</tr> <tr> <td> </td> <td> Email Address </td> <td> : </td> <td> " + txtEmail.Text + "</td>"; emailBody += "</tr> <tr> <td> </td> <td> Message </td> <td valign='top'> : </td> <td> " + txtRemarks.Text + "</td> </tr> </table>"; EmailSender.SendEmail(drSmtp.SMTPAccount, "*****@*****.**", "New Enquiry From " + txtContactPerson.Text + "</br>", emailBody, drSmtp.SMTPHost, drSmtp.SMTPPort, drSmtp.SMTPUserName, drSmtp.SMTPPassword, drSmtp.SMTPSSL, drSmtp.SMTPIIS); divContactUs.Visible = false; CompleteContactUs.Visible = true; } }
protected void btnDelete_Click(object sender, EventArgs e) { string usr = WebSecurity.CurrentUserName; if (!string.IsNullOrEmpty(txtPassword.Text)) { if (Membership.ValidateUser(usr, txtPassword.Text)) { CustomerDAC dac = new CustomerDAC(); Guid userID = dac.RetrieveUserGUID(usr); string err = ""; if (dac.DeactivateUser(usr, userID, out err)) { accountCancel.Visible = false; CompleteConfirm.Visible = true; } else { lblError.Visible = true; if (err == "Unable to find user") { lblError.Text = "Unknown error, please retry login"; } } } else { lblError.Visible = true; lblError.Text = "Invalid password"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Page.RouteData.Values[SystemConstants.qs_ActivitiesID] != null) { ActivityID = Convert.ToInt32(Page.RouteData.Values[SystemConstants.qs_ActivitiesID].ToString()); } if (Request.QueryString[SystemConstants.qs_ActivitiesID] != null) { ActivityID = Convert.ToInt32(Request.QueryString[SystemConstants.qs_ActivitiesID]); } if (ActivityID != 0) { var dr = new CustomerDAC().RetrieveActivityImages(ActivityID); if (dr != null) { ImagesListViewUC1.ActivityID = ActivityID; } else { gallery.Visible = false; } Refresh(); } } }
public ActionResult Customer(CustomerModel customer) { CustomerLoadCombos(); List <CustomerModel> oLst = CustomerDAC.Get(customer); return(View(oLst)); }
private void SendConfirmationEmail(Guid userID, string token) { var MailConf = new CustomerDAC().RetrieveWebConfiguration(); var emTemp = new CustomerDAC().RetrieveMailTemplate((int)SystemConstants.EmailTemplateType.ConfirmationEmail); new CustomerBFC().ParseEmail(emTemp, userID, token, (int)SystemConstants.EmailTemplateType.ConfirmationEmail, 0); EmailSender.SendEmail(MailConf.SMTPAccount, Email.Text, emTemp.EmailSubject, emTemp.EmailBody, MailConf.SMTPHost, MailConf.SMTPPort, MailConf.SMTPUserName, MailConf.SMTPPassword, MailConf.SMTPSSL, MailConf.SMTPIIS); }
public ActionResult CustomerEdit(Int64?Id) { CustomerLoadCombos(); CustomerModel oCustomer = CustomerDAC.Get(new CustomerModel { Id = Id }).FirstOrDefault(); return(View(oCustomer)); }
private void RetrieveSavedList() { var dt = new CustomerDAC().retrieveUserActivityList(new Guid(Session[SystemConstants.ses_UserID].ToString())); if (dt != null) { List <int> savedList = new List <int>(dt.Select(x => x.ListValue)); SavedList = string.Join("|", savedList); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SetLinkTarget(); } if (WebSecurity.IsAuthenticated) { LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName; Guid UserID = new CustomerDAC().RetrieveUserGUID(WebSecurity.CurrentUserName); if (!string.IsNullOrEmpty((string)Session[SystemConstants.ses_FName])) { loginName.FormatString = (string)Session[SystemConstants.ses_FName]; } else { var dr = new CustomerDAC().RetrieveUserProfiles(UserID); if (dr != null) { Session[SystemConstants.ses_FName] = dr.FirstName; Session[SystemConstants.ses_LName] = dr.LastName; Session[SystemConstants.ses_Role] = SystemConstants.CustomerRole; Session[SystemConstants.ses_Email] = dr.Email; Session[SystemConstants.ses_UserID] = dr.UserID; var drr = new CustomerDAC().RetrieveUserRewardDetails(dr.FirstName); if (drr != null) { Session[SystemConstants.ses_Rwdpts] = Convert.ToString(drr.RewardPoint); } } else { var drp = new CustomerDAC().RetrieveProviderProfiles(UserID); if (drp != null) { WebSecurity.Logout(); } } } loginName.FormatString = (string)Session[SystemConstants.ses_FName]; string path = HttpContext.Current.Request.Url.AbsolutePath; if (!path.Contains("Redeem")) { updatecartfilter(); } string pts = (String)(Session[SystemConstants.ses_Rwdpts]); //HyperLink hlnkRewards = HeadLoginView.FindControl("hlnkRewards") as HyperLink; loginName.FormatString = (string)Session[SystemConstants.ses_FName] + " (" + pts + " pts)"; } }
protected void btnSave_Click(object sender, EventArgs e) { if (!isError()) { CustomerEDSC.UserProfilesDTRow dr = GetRegistrationData(); CustomerDAC dac = new CustomerDAC(); dac.UpdateUserProfiles(dr); Membership.GetUser().Email = dr.Email; } Mode = SystemConstants.FormMode.View; SetUserInformation(); }
public static Result RegisterCustomer(Customer customer) { if (CustomerDAC.IsCustomerRegistered(customer) == 0) { return(CustomerDAC.RegisterCustomer(customer)); } else { return(new Result() { Message = "El usuario ya exite, use login para ingresar", Status = ResultStatus.Error }); } }
protected void Page_Init(object sender, EventArgs e) { var web = new CustomerDAC().RetrieveWebConfiguration(); EnableRecaptcha = web.EnableCaptcha; if (EnableRecaptcha) { RecaptchaControl1.PublicKey = System.Configuration.ConfigurationManager.AppSettings[SystemConstants.reCaptchaPublicKey].ToString(); RecaptchaControl1.PrivateKey = System.Configuration.ConfigurationManager.AppSettings[SystemConstants.reCaptchaPrivateKey].ToString(); } else { trCaptcha.Visible = EnableRecaptcha; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Membership.GetUser() != null && Membership.GetUser().IsOnline) { var dr = new CustomerDAC().RetrieveUserProfiles(new Guid(Membership.GetUser().ProviderUserKey.ToString())); if (dr != null) { SetData(dr); } } SetButton(); } }
private void initDDLSuburbs() { CustomerEDSC.v_SuburbExplorerDTDataTable dt = new CustomerDAC().RetrieveSuburbs(); CustomerEDSC.v_SuburbExplorerDTDataTable dtSub = new CustomerDAC().RetrieveSuburbs(); ListItemCollection subList = new ListItemCollection(); DropDownCheckBoxes1.DataSource = dtSub; DropDownCheckBoxes1.DataTextField = "Name"; DropDownCheckBoxes1.DataValueField = "ID"; DropDownCheckBoxes1.DataBind(); }
private void Refresh() { var dr = new CustomerDAC().RetrieveActivityExplorer(ActivityID); if (dr != null) { SetTitle(dr.ProviderID); SetActivityInformation(dr); SetTimetableInformation(); ActivityNavigationUC1.SetNavigation(dr.Name, dr.ActivityID, dr.CategoryID, dr.CategoryName); } else { Response.Redirect("~/Activities"); } }
protected void Voucher_Click(object sender, EventArgs e) { string IDs = RewardCart.Instance.getItems(); string dates = RewardCart.Instance.getExpiry(); string Names = RewardCart.Instance.getNames(); string[] Name = Names.Split('|'); string[] ID = IDs.Split('|'); string[] expdate = dates.Split('|'); int i; int count = RewardCart.Instance.getitemno(); string separator = "|"; for (i = 0; i < count; i++) { int quant = RewardCart.Instance.getItemQuant(Convert.ToInt32(ID[i])); Random rnd = new Random(); string[] coupon = new string[count + quant]; for (int k = 0; k < coupon.Length; k++) { coupon[k] = GenerateCoupon(6, rnd); } for (int j = 0; j < quant; j++) { CustomerEDSC.VoucherDetailsDTRow dr = new CustomerEDSC.VoucherDetailsDTDataTable().NewVoucherDetailsDTRow(); CustomerDAC dac = new CustomerDAC(); dr.RewardID = Convert.ToInt32(ID[i]); dr.SponsorID = dac.getSponsorID(Convert.ToInt32(ID[i])); dr.ExpiryDate = Convert.ToDateTime(expdate[i]); dr.IssueDate = DateTime.Today; dr.UsageStatus = true; dr.RewardName = Name[i]; dr.VoucherCode = coupon[i + j]; dac.InsertNewVoucherDetail(dr); if (!String.IsNullOrEmpty(selected)) { selected += separator; } selected += Convert.ToString(dr.VoucherCode); } } redempted.Visible = true; }
protected void ListViewRewards_ItemDataBound(object sender, ListViewItemEventArgs e) { actNo++; Label lblNo = e.Item.FindControl("lblNo") as Label; HyperLink HlnkReadMore = e.Item.FindControl("HlnkReadMore") as HyperLink; HyperLink HlnkRewardsName = e.Item.FindControl("HlnkRewardsName") as HyperLink; HyperLink HlnkClickHere = e.Item.FindControl("HlnkClickHere") as HyperLink; HiddenField hdnRewardsID = e.Item.FindControl("hdnRewardsID") as HiddenField; HiddenField hdnRewardImage = e.Item.FindControl("hdnRewardImage") as HiddenField; System.Web.UI.WebControls.Image imgPreview = e.Item.FindControl("imgPreview") as System.Web.UI.WebControls.Image; HlnkRewardsName.NavigateUrl = HlnkReadMore.NavigateUrl = "~/Rewards/Rewards.aspx?" + SystemConstants.qs_RewardsID + "=" + hdnRewardsID.Value; HiddenField hdnExpiryDate = e.Item.FindControl("hdnExpiryDate") as HiddenField; Button Addtocart = e.Item.FindControl("Addtocart") as Button; Button Checkout = e.Item.FindControl("AddtocartNcheckout") as Button; Label points = e.Item.FindControl("lblpoints") as Label; Addtocart.ID = hdnRewardsID.Value; Addtocart.CommandName = points.Text; Checkout.CommandName = hdnRewardsID.Value; Checkout.CommandArgument = points.Text; //Image imgStatus = e.Item.FindControl("imgStatus") as Image; if (!string.IsNullOrEmpty(hdnRewardImage.Value)) { if (Convert.ToBoolean(hdnRewardImage.Value)) { var dr = new CustomerDAC().RetrieveRewardPrimaryImage(Convert.ToInt32(hdnRewardsID.Value)); if (dr != null || dr.ImageStream != null) { //Convert byte directly, while its easier, its not suppose to be //imgPreview.ImageUrl = "data:image/jpeg;base64," + Convert.ToBase64String(dr.ImageStream); imgPreview.ImageUrl = "~/ImageHandler.ashx?" + SystemConstants.qs_RewardThumbImageID + "=" + dr.ID; } } else { imgPreview.ImageUrl = "~/Images/gift.jpg"; } } else { imgPreview.ImageUrl = "~/Images/gift.jpg"; } }
private void initTimetable() { var SchedulesDT = new CustomerDAC().RetrieveActivitySchedules(ActivityID); if (SchedulesDT != null) { var schedule = CreateSeasonalTimetable(SchedulesDT); ListView1.DataSource = schedule; ListView1.DataBind(); } else { divNoTimetable.Visible = true; lblNoTimetable.Text = SystemConstants.ErrorSchedulenotGiven; } }
public static void UpdateActivity(CustomerEDSC.ActivityDTRow drDetail, CustomerEDSC.ActivityContactDetailDTRow contactDetails, CustomerEDSC.ActivityGroupingDTRow drActGrouping, CustomerEDSC.ActivityScheduleDTDataTable dtActSchedule) { CustomerDAC dac = new CustomerDAC(); using (TransactionScope trans = new TransactionScope()) { dac.UpdateActivity(drDetail); dac.UpdateActivityContactDetail(contactDetails); dac.DeleteActivitySchedules(drDetail.ID); foreach (var drActSchedule in dtActSchedule) { dac.CreateActivitySchedule(drActSchedule); } dac.UpdateActivityGrouping(drActGrouping); trans.Complete(); } }
private void SetDDL() { CustomerEDSC.StateDTDataTable dtState = new CustomerDAC().RetrieveStates(); ddlState.Items.Clear(); ListItem lis = new ListItem("State", "0"); ddlState.Items.Add(lis); foreach (var dr in dtState) { string name = ""; if (dr.ID != 0) { name = dr.StateName; } lis = new ListItem(name, dr.ID.ToString()); ddlState.Items.Add(lis); } CustomerEDSC.StateDTDataTable dtState2 = new CustomerDAC().RetrieveStates(); ddlState.Items.Clear(); ListItem lis2 = new ListItem("State", "0"); ddlState.Items.Add(lis2); foreach (var drstate2 in dtState2) { string name = ""; if (drstate2.ID != 0) { name = drstate2.StateName; } lis2 = new ListItem(name, drstate2.ID.ToString()); ddlState.Items.Add(lis2); } }
private void CheckUserStatus() { CustomerDAC dac = new CustomerDAC(); Guid userID = dac.RetrieveUserGUID(WebSecurity.CurrentUserName); var drP = dac.RetrieveUserProfiles(userID); if (drP != null) { if (drP.AccountDeletion) { accountCancel.Visible = false; CompleteConfirm.Visible = true; } } else { Response.Redirect(SystemConstants.ProviderUrl + "Account"); } }
void Refresh() { Addtocart.CommandName = Convert.ToString(RewardID); AddtocartNcheckout.CommandName = Convert.ToString(RewardID); var dr = new CustomerDAC().RetrieveRewardInfo(Convert.ToInt32(RewardID)); if (dr != null) { string check = Convert.ToString(dr.RewardImage); if (!string.IsNullOrEmpty(check)) { if (Convert.ToBoolean(check)) { var drr = new CustomerDAC().RetrieveRewardPrimaryImage(Convert.ToInt32(RewardID)); if (drr != null || drr.ImageStream != null) { //Convert byte directly, while its easier, its not suppose to be //imgPreview.ImageUrl = "data:image/jpeg;base64," + Convert.ToBase64String(dr.ImageStream); imgPreview.ImageUrl = "~/ImageHandler.ashx?" + SystemConstants.qs_RewardThumbImageID + "=" + drr.ID; } } else { imgPreview.ImageUrl = "~/Images/gift.jpg"; } } lblsearch.Text = "Reward '" + dr.RewardsName + "'"; lblpoints.Text = Convert.ToString(dr.RequiredRewardPoint); lblLongDescription.Text = dr.RewardDescription; RwdExpiry.Text = Convert.ToString(dr.RewardExpiryDate); lblName.Text = dr.RewardsName; } else { imgPreview.Visible = false; lblpoints.Visible = false; lblLongDescription.Visible = false; lblName.Visible = false; RwdExpiry.Visible = false; } }
protected void CreatedUser(Guid userID) { CustomerBFC bfc = new CustomerBFC(); CustomerDAC dac = new CustomerDAC(); CustomerEDSC.UserProfilesDTRow dr = GetRegistrationData(); dr.UserID = userID; dac.InsertNewUserProfiles(dr); CustomerEDSC.UserRewardDTRow drr = GetRewardData(); drr.UserID = userID; dac.InsertNewRewardUser(drr); var drRef = new CustomerEDSC.UserReferenceDTDataTable().NewUserReferenceDTRow(); drRef.UserID = userID; drRef.ReferenceID = bfc.GenerateUserRefID(dr.LastName, dr.FirstName); dac.insertNewUserReference(drRef); }