public static DataTable AddFeedBack(Feedback fb) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "VOC.BS_FeedBack_AddFeedback"; ParameterCollection.Add(new clsParameter("@Name", fb.FullName)); ParameterCollection.Add(new clsParameter("@MobileNumber", fb.MobileNumber)); ParameterCollection.Add(new clsParameter("@Email", fb.Email)); return DataAccess.ExecuteSpAndGetDataTable(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
public string xSendVoucher(string BuyerGuid, string ProductGuid, string templateid, string ExternalOrderID, string Quantity, string CustomerFName, string CustomerMName, string CustomerLName, string CommunicationMode, string EmailTo, string MobileNo, string Password, string emailcc) { //checking email isEmail = Regex.IsMatch(EmailTo, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase); //checking mobile isMobile = Regex.IsMatch(MobileNo, @"^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$", RegexOptions.IgnoreCase); if (BuyerGuid == string.Empty || BuyerGuid == null) { return "BuyerGuid must not be empty"; } else if (ProductGuid == string.Empty || ProductGuid == null) { return "ProductGuid must not be empty"; } if (templateid == string.Empty || templateid == null) { return "templateid must not be empty"; } else if (ExternalOrderID == string.Empty || ExternalOrderID == null) { return "ExternalOrderID must not be empty"; } else if (CustomerFName == string.Empty || CustomerFName == null) { return "CustomerFName must not be empty"; } else if (CommunicationMode == string.Empty || CommunicationMode == null) { return "CommunicationMode must not be empty"; } else if (EmailTo == string.Empty || EmailTo == null) { return "EmailTo must not be empty"; } else if(!isEmail) { return "Please enter valid email Id"; } else if (MobileNo == string.Empty || MobileNo == null) { return "Mobile number must not be empty"; } else if (!isMobile) { return "Enter valid mobile number"; } else if (Password == string.Empty || Password == null) { return "Password must not be empty"; } else { Feedback fb = new Feedback(); if ((CustomerMName == string.Empty || CustomerMName == null) || (CustomerLName == string.Empty || CustomerLName == null)) fb.FullName = string.Format("{0}", CustomerFName); else fb.FullName = string.Format("{0} {1} {2}", CustomerFName, CustomerMName, CustomerLName); fb.MobileNumber = MobileNo; fb.Email = EmailTo; DataTable getfb = BL_FeedBack.AddFeedBack(fb); if (getfb != null) { string voucherno = ""; foreach (DataRow row in getfb.Rows) voucherno = row["VoucherNo"].ToString(); string message = "Your gift voucher number is " + voucherno; BL_SMSNotification.Notification(MobileNo,message); string Body = "<html><body><h3>Dear " + fb.FullName.Trim() + "</h3><br/><h4>Your Gift Voucher with Bestseller Gift Voucher Management is " + voucherno +"<br/> Thank You<br/>Bestseller Groups</h4></body></html>"; SendEmail.SendMail("*****@*****.**", EmailTo, "Feedback Voucher", Body); return "Feedback get successfully"; } } return ""; }