public SPResponse AddBulkCustomerData(string GroupId, CustomerDetail objCustomer) { SPResponse result = new SPResponse(); try { string connStr = objCustRepo.GetCustomerConnString(GroupId); using (var contextNew = new BOTSDBContext(connStr)) { var ObjMobileNo = contextNew.CustomerDetails.Where(x => x.MobileNo == objCustomer.MobileNo).FirstOrDefault(); if (ObjMobileNo == null) { var CustomerId = contextNew.CustomerDetails.OrderByDescending(x => x.CustomerId).Select(y => y.CustomerId).FirstOrDefault(); var NewId = Convert.ToInt64(CustomerId) + 1; objCustomer.CustomerId = Convert.ToString(NewId); contextNew.CustomerDetails.AddOrUpdate(objCustomer); contextNew.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Member Added Successfully"; } else { result.ResponseCode = "01"; result.ResponseMessage = "Mobile Number Already Exist"; } } } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(result); }
public SPResponse AddRedeemPointsData(string GroupId, string MobileNo, string OutletId, DateTime TxnDate, DateTime RequestDate, string InvoiceNo, string InvoiceAmt, decimal Points, string IsSMS, string TxnType, tblAudit objAudit) { SPResponse result = new SPResponse(); try { string connStr = objCustRepo.GetCustomerConnString(GroupId); using (var contextNew = new BOTSDBContext(connStr)) { result = contextNew.Database.SqlQuery <SPResponse>("sp_BurnRW_New_ITOPS @pi_MobileNo, @pi_OutletId, @pi_TxnDate, @pi_RequestDate, @pi_InvoiceNo, @pi_InvoiceAmt,@pi_RedeemPoints, @pi_LoginId, @pi_RequestBy, @pi_RequestedOnForum, @pi_SMSFlag, @pi_TxnType", new SqlParameter("@pi_MobileNo", MobileNo), new SqlParameter("@pi_OutletId", OutletId), new SqlParameter("@pi_TxnDate", TxnDate.ToString("yyyy-MM-dd")), new SqlParameter("@pi_RequestDate", RequestDate.ToString("yyyy-MM-dd")), new SqlParameter("@pi_InvoiceNo", InvoiceNo), new SqlParameter("@pi_InvoiceAmt", InvoiceAmt), new SqlParameter("@pi_RedeemPoints", Points), new SqlParameter("@pi_LoginId", ""), new SqlParameter("@pi_RequestBy", objAudit.RequestedBy), new SqlParameter("@pi_RequestedOnForum", objAudit.RequestedOnForum), new SqlParameter("@pi_SMSFlag", IsSMS), new SqlParameter("@pi_TxnType", TxnType)).FirstOrDefault <SPResponse>(); } using (var context = new CommonDBContext()) { context.tblAudits.Add(objAudit); context.SaveChanges(); } } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(result); }
public SPResponse AddLoadBonusData(string GroupId, string MobileNo, string OutletId, int BonusPoints, string BonusRemark, DateTime ExpiryDate, string IsSMS, tblAudit objAudit) { SPResponse result = new SPResponse(); try { string connStr = objCustRepo.GetCustomerConnString(GroupId); using (var contextNew = new BOTSDBContext(connStr)) { result = contextNew.Database.SqlQuery <SPResponse>("sp_BonusPoints_ITOPS @pi_MobileNo, @pi_OutletId, @pi_RequestDate, @pi_ExpiryDate, @pi_BonusRemarks, @pi_BonusPoints,@pi_LoginId, @pi_RequestBy, @pi_RequestedOnForum, @pi_SMSFlag", new SqlParameter("@pi_MobileNo", MobileNo), new SqlParameter("@pi_OutletId", OutletId), new SqlParameter("@pi_RequestDate", objAudit.RequestedOn.ToString("yyyy-MM-dd")), new SqlParameter("@pi_ExpiryDate", ExpiryDate.ToString("yyyy-MM-dd")), new SqlParameter("@pi_BonusRemarks", BonusRemark), new SqlParameter("@pi_BonusPoints", BonusPoints), new SqlParameter("@pi_LoginId", ""), new SqlParameter("@pi_RequestBy", objAudit.RequestedBy), new SqlParameter("@pi_RequestedOnForum", objAudit.RequestedOnForum), new SqlParameter("@pi_SMSFlag", IsSMS)).FirstOrDefault <SPResponse>(); } using (var context = new CommonDBContext()) { context.tblAudits.Add(objAudit); context.SaveChanges(); } } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(result); }
public ActionResult AddSingleMember(string jsonData) { SPResponse result = new SPResponse(); string GroupId = ""; try { JavaScriptSerializer json_serializer = new JavaScriptSerializer(); json_serializer.MaxJsonLength = int.MaxValue; object[] objData = (object[])json_serializer.DeserializeObject(jsonData); tblAudit objAudit = new tblAudit(); CustomerDetail objCustomer = new CustomerDetail(); foreach (Dictionary <string, object> item in objData) { GroupId = Convert.ToString(item["GroupID"]); objCustomer.MobileNo = Convert.ToString(item["MobileNo"]); objCustomer.CardNumber = Convert.ToString(item["CardNo"]); objCustomer.CustomerName = Convert.ToString(item["FullName"]); objCustomer.Gender = Convert.ToString(item["Gender"]); if (!string.IsNullOrEmpty(Convert.ToString(item["BirthDay"]))) { objCustomer.DOB = Convert.ToDateTime(item["BirthDay"]); } objCustomer.CustomerThrough = Convert.ToString(item["Source"]); objCustomer.EnrollingOutlet = Convert.ToString(item["OutletId"]); objCustomer.MemberGroupId = "1000"; objCustomer.DOJ = DateTime.Now; objCustomer.Status = "00"; objAudit.GroupId = GroupId; objAudit.RequestedFor = "User Added"; objAudit.RequestedEntity = "User Added - " + objCustomer.MobileNo; objAudit.RequestedBy = Convert.ToString(item["RequestedBy"]); objAudit.RequestedOnForum = Convert.ToString(item["RequestedForum"]); objAudit.RequestedOn = Convert.ToDateTime(item["RequestedDate"]); } result = ITOPS.AddSingleCustomerData(GroupId, objCustomer, objAudit); if (result.ResponseCode == "00") { var subject = "New Customer Added with Mobile No - " + objCustomer.MobileNo; var body = "New Customer Added with Mobile No - " + objCustomer.MobileNo; body += "<br/><br/> Regards <br/> Blue Ocktopus Team"; SendEmail(GroupId, subject, body); } //if (Convert.ToBoolean(IsSMS)) //{ // //Logic to send SMS to Customer whose Name is changed //} } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult AddBillingPartnerProduct(string jsonData) { SPResponse result = new SPResponse(); var userDetails = (CustomerLoginDetail)Session["UserSession"]; string BillingPartnerId = ""; try { JavaScriptSerializer json_serializer = new JavaScriptSerializer(); json_serializer.MaxJsonLength = int.MaxValue; object[] objData = (object[])json_serializer.DeserializeObject(jsonData); BOTS_TblBillingPartnerProduct objbillingpartnerproduct = new BOTS_TblBillingPartnerProduct(); foreach (Dictionary <string, object> item in objData) { objbillingpartnerproduct.BillingPartnerProductName = Convert.ToString(item["BillingPartnerproductNm"]); objbillingpartnerproduct.BillingPartnerId = Convert.ToInt32(item["BillingPartnerId"]); objbillingpartnerproduct.CreatedBy = userDetails.LoginId; objbillingpartnerproduct.CreatedDate = DateTime.Now; BillingPartnerId = Convert.ToString(item["BillingPartnerId"]); objbillingpartnerproduct.IsActive = Convert.ToBoolean(item["IsActive"]); if (BillingPartnerId != "") { objbillingpartnerproduct.BillingPartnerId = Convert.ToInt32(BillingPartnerId); } else { } } result = COR.AddBillingPartnerProduct(objbillingpartnerproduct); } catch (Exception ex) { } return(Json(result, JsonRequestBehavior.AllowGet)); }
public SPResponse ActiveInactiveChannelPartner(int ChannelPartnerId) { tblChannelPartner objchannel = new tblChannelPartner(); SPResponse result = new SPResponse(); using (var context = new CommonDBContext()) { objchannel = context.tblChannelPartners.Where(x => x.CPId == ChannelPartnerId).FirstOrDefault(); if (objchannel.IsActive == true) { objchannel.IsActive = false; } else { objchannel.IsActive = true; } context.tblChannelPartners.AddOrUpdate(objchannel); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Channel Partner Updated Successfully"; } return(result); }
public SPResponse ActiveInactiveCity(int CityId) { tblCity objcity = new tblCity(); SPResponse result = new SPResponse(); using (var context = new CommonDBContext()) { objcity = context.tblCities.Where(x => x.CityId == CityId).FirstOrDefault(); if (objcity.IsActive == true) { objcity.IsActive = false; } else { objcity.IsActive = true; } context.tblCities.AddOrUpdate(objcity); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "City Updated Successfully"; } return(result); }
public SPResponse ActiveInactiveCS(int RmAssignedId) { tblRMAssigned objRM = new tblRMAssigned(); SPResponse result = new SPResponse(); using (var context = new CommonDBContext()) { objRM = context.tblRMAssigneds.Where(x => x.RMAssignedId == RmAssignedId).FirstOrDefault(); if (objRM.IsActive == true) { objRM.IsActive = false; } else { objRM.IsActive = true; } context.tblRMAssigneds.AddOrUpdate(objRM); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "CS Updated Successfully"; } return(result); }
public SPResponse ActiveInactiveSourceType(int SourceTypeid) { tblSourceType objsourcetype = new tblSourceType(); SPResponse result = new SPResponse(); using (var context = new CommonDBContext()) { objsourcetype = context.tblSourceTypes.Where(x => x.SourceTypeId == SourceTypeid).FirstOrDefault(); if (objsourcetype.IsActive == true) { objsourcetype.IsActive = false; } else { objsourcetype.IsActive = true; } context.tblSourceTypes.AddOrUpdate(objsourcetype); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Source Type Updated Successfully"; } return(result); }
public SPResponse ActiveInactiveBillingPartnerProduct(int BillingPartnerProductId) { BOTS_TblBillingPartnerProduct objbillingpartnerproduct = new BOTS_TblBillingPartnerProduct(); SPResponse result = new SPResponse(); using (var context = new CommonDBContext()) { objbillingpartnerproduct = context.BOTS_TblBillingPartnerProduct.Where(x => x.BillingPartnerProductId == BillingPartnerProductId).FirstOrDefault(); if (objbillingpartnerproduct.IsActive == true) { objbillingpartnerproduct.IsActive = false; } else { objbillingpartnerproduct.IsActive = true; } context.BOTS_TblBillingPartnerProduct.AddOrUpdate(objbillingpartnerproduct); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Billing Partner product Updated Successfully"; } return(result); }
public SPResponse DeleteTransaction(string GroupId, string InvoiceNo, string MobileNo, string InvoiceAmt, DateTime ip_Date, tblAudit objAudit) { SPResponse result = new SPResponse(); try { string connStr = objCustRepo.GetCustomerConnString(GroupId); using (var contextNew = new BOTSDBContext(connStr)) { result = contextNew.Database.SqlQuery <SPResponse>("sp_CancelTxn1_ITOPS @pi_MobileNo, @pi_InvoiceNo, @pi_InvoiceAmt, @pi_RequestDate, @pi_Datetime, @pi_LoginId,@pi_RequestBy, @pi_RequestedOnForum, @pi_SMSFlag", new SqlParameter("@pi_MobileNo", MobileNo), new SqlParameter("@pi_InvoiceNo", InvoiceNo), new SqlParameter("@pi_InvoiceAmt", InvoiceAmt), new SqlParameter("@pi_RequestDate", objAudit.RequestedOn), new SqlParameter("@pi_Datetime", ip_Date), new SqlParameter("@pi_LoginId", ""), new SqlParameter("@pi_RequestBy", objAudit.RequestedBy), new SqlParameter("@pi_RequestedOnForum", objAudit.RequestedOnForum), new SqlParameter("@pi_SMSFlag", "0")).FirstOrDefault <SPResponse>(); } using (var context = new CommonDBContext()) { context.tblAudits.Add(objAudit); context.SaveChanges(); } } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(result); }
public ActionResult AddSourceType(string jsonData) { SPResponse result = new SPResponse(); var userDetails = (CustomerLoginDetail)Session["UserSession"]; string SourceTypeId = ""; try { JavaScriptSerializer json_serializer = new JavaScriptSerializer(); json_serializer.MaxJsonLength = int.MaxValue; object[] objData = (object[])json_serializer.DeserializeObject(jsonData); tblSourceType objsourcetype = new tblSourceType(); foreach (Dictionary <string, object> item in objData) { objsourcetype.SourceTypeName = Convert.ToString(item["SourceTypeNm"]); objsourcetype.CreatedBy = userDetails.LoginId; objsourcetype.CreatedDate = DateTime.Now; SourceTypeId = Convert.ToString(item["SourceTypeId"]); objsourcetype.IsActive = Convert.ToBoolean(item["IsActive"]); if (SourceTypeId != "") { objsourcetype.SourceTypeId = Convert.ToInt32(SourceTypeId); } else { } } result = COR.AddSourceType(objsourcetype); } catch (Exception ex) { } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult LoadBonusData(string jsonData) { SPResponse result = new SPResponse(); string GroupId = ""; try { JavaScriptSerializer json_serializer = new JavaScriptSerializer(); json_serializer.MaxJsonLength = int.MaxValue; object[] objData = (object[])json_serializer.DeserializeObject(jsonData); tblAudit objAudit = new tblAudit(); bool IsSMS = false; string MobileNo = ""; int BonusPoints = 0; string BonusRemark = ""; string OutletId = ""; DateTime ExpiryDate = DateTime.Now; foreach (Dictionary <string, object> item in objData) { GroupId = Convert.ToString(item["GroupID"]); MobileNo = Convert.ToString(item["MobileNo"]); OutletId = Convert.ToString(item["OutletId"]); BonusPoints = Convert.ToInt32(item["BonusPoints"]); BonusRemark = Convert.ToString(item["BonusRemark"]); ExpiryDate = Convert.ToDateTime(item["ExpiryDate"]); objAudit.GroupId = GroupId; objAudit.RequestedFor = "Load Bonus"; objAudit.RequestedEntity = "Load Bonus for - " + MobileNo; objAudit.RequestedBy = Convert.ToString(item["RequestedBy"]); objAudit.RequestedOnForum = Convert.ToString(item["RequestedForum"]); objAudit.RequestedOn = Convert.ToDateTime(item["RequestedDate"]); IsSMS = Convert.ToBoolean(item["IsSMS"]); } result = ITOPS.AddLoadBonusData(GroupId, MobileNo, OutletId, BonusPoints, BonusRemark, ExpiryDate, Convert.ToString(IsSMS), objAudit); if (result.ResponseCode == "00") { var subject = "Points Loaded for mobile no - " + MobileNo; var body = "Points Loaded for mobile no - " + MobileNo; body += "<br/><br/> Regards <br/> Blue Ocktopus Team"; SendEmail(GroupId, subject, body); } if (Convert.ToBoolean(IsSMS)) { //Logic to send SMS to Customer whose Name is changed } } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult GetOutletByBrandId(string GroupId, string BrandId) { string connStr = objCustRepo.GetCustomerConnString(GroupId); SPResponse result = new SPResponse(); var lstoutletlist = RR.GetOutletListByBrandId(BrandId, connStr); ViewBag.OutletListByBrand = lstoutletlist; return(Json(lstoutletlist, JsonRequestBehavior.AllowGet)); }
public ActionResult ActiveInactiveCustomerSuccess(int RmAssignedId) { SPResponse result = new SPResponse(); try { result = COR.ActiveInactiveCS(RmAssignedId); } catch (Exception ex) { } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult ActiveInactiveChannelPartner(int ChannelPartnerid) { SPResponse result = new SPResponse(); try { result = COR.ActiveInactiveChannelPartner(ChannelPartnerid); } catch (Exception ex) { } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult ActiveInactiveBillingPartnerProduct(int BillingPartnerProductId) { SPResponse result = new SPResponse(); try { result = COR.ActiveInactiveBillingPartnerProduct(BillingPartnerProductId); } catch (Exception ex) { } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult ActiveInactiveSourceType(int SourceTypeid) { SPResponse result = new SPResponse(); try { result = COR.ActiveInactiveSourceType(SourceTypeid); } catch (Exception ex) { } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult ChangeMemberMobile(string jsonData) { SPResponse result = new SPResponse(); string GroupId = ""; try { JavaScriptSerializer json_serializer = new JavaScriptSerializer(); json_serializer.MaxJsonLength = int.MaxValue; object[] objData = (object[])json_serializer.DeserializeObject(jsonData); tblAudit objAudit = new tblAudit(); bool IsSMS = false; string CustomerId = ""; string MobileNo = ""; foreach (Dictionary <string, object> item in objData) { GroupId = Convert.ToString(item["GroupID"]); CustomerId = Convert.ToString(item["CustomerId"]); MobileNo = Convert.ToString(item["MobileNo"]); objAudit.GroupId = GroupId; objAudit.RequestedFor = "Mobile Number Change"; objAudit.RequestedEntity = "CustomerId - " + CustomerId; objAudit.RequestedBy = Convert.ToString(item["RequestedBy"]); objAudit.RequestedOnForum = Convert.ToString(item["RequestedForum"]); objAudit.RequestedOn = Convert.ToDateTime(item["RequestedOn"]); IsSMS = Convert.ToBoolean(item["IsSMS"]); } result = ITOPS.UpdateMobileOfMember(GroupId, CustomerId, MobileNo, objAudit); if (result.ResponseCode == "00") { var subject = "Customer Mobile Number changed for CustomerId - " + CustomerId; var body = "Customer Mobile Number changed for CustomerId - " + CustomerId; body += "<br/><br/> Regards <br/> Blue Ocktopus Team"; SendEmail(GroupId, subject, body); } if (IsSMS) { //Logic to send SMS to Customer whose Name is changed } } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult ActiveInactiveCity(int Cityid) { SPResponse result = new SPResponse(); try { // tblCity objcity = COR.GetCityById(Cityid); result = COR.ActiveInactiveCity(Cityid); } catch (Exception ex) { } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult ActiveInactiveBillingPartner(int BillingpartnerId) { SPResponse result = new SPResponse(); try { // tblBillingPartner objbillingpartner = COR.GetBillingPartnerById(BillingpartnerId); result = COR.ActiveInactiveBillingPartner(BillingpartnerId); } catch (Exception ex) { } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult GetLoginIdByOutlets(string GroupId, int outletId) { SPResponse result = new SPResponse(); ResetSecurityKey objreset = new ResetSecurityKey(); try { objreset.lstloginid = ITOPS.GetLoginIdByOutlet(GroupId, outletId); } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(Json(objreset, JsonRequestBehavior.AllowGet)); }
public SPResponse AddBillingPartnerProduct(BOTS_TblBillingPartnerProduct objtblbillingpartnerproduct) { SPResponse result = new SPResponse(); try { using (var context = new CommonDBContext()) { context.BOTS_TblBillingPartnerProduct.AddOrUpdate(objtblbillingpartnerproduct); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Billing Partner Product Added Successfully"; } } catch (Exception ex) { newexception.AddException(ex, "onboarding_master"); } return(result); }
public SPResponse AddRM(tblRMAssigned objtblRMAssigned) { SPResponse result = new SPResponse(); try { using (var context = new CommonDBContext()) { context.tblRMAssigneds.AddOrUpdate(objtblRMAssigned); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Customer Success Added Successfully"; } } catch (Exception ex) { newexception.AddException(ex, "onboarding_master"); } return(result); }
public SPResponse AddSource(tblSourcedBy objtblSourceBy) { SPResponse result = new SPResponse(); try { using (var context = new CommonDBContext()) { context.tblSourcedBies.AddOrUpdate(objtblSourceBy); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Source Added Successfully"; } } catch (Exception ex) { newexception.AddException(ex, "onboarding_master"); } return(result); }
public SPResponse AddChannelPartner(tblChannelPartner objtblchannel) { SPResponse result = new SPResponse(); try { using (var context = new CommonDBContext()) { context.tblChannelPartners.AddOrUpdate(objtblchannel); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Channel Partner Added Successfully"; } } catch (Exception ex) { newexception.AddException(ex, "onboarding_master"); } return(result); }
public ActionResult DeleteTransaction(string GroupId, string InvoiceNo, string MobileNo, string InvoiceAmt, string ip_Date, string RequestedBy, string RequestedForum, string RequestedDate) { SPResponse result = new SPResponse(); try { tblAudit objAudit = new tblAudit(); objAudit.GroupId = GroupId; objAudit.RequestedFor = "Delete Transaction"; objAudit.RequestedEntity = "Delete Transaction for Invoice - " + InvoiceNo; objAudit.RequestedBy = RequestedBy; objAudit.RequestedOnForum = RequestedForum; objAudit.RequestedOn = Convert.ToDateTime(RequestedDate); bool IsSMS = false; var dateCancel = Convert.ToDateTime(ip_Date); result = ITOPS.DeleteTransaction(GroupId, InvoiceNo, MobileNo, InvoiceAmt, dateCancel, objAudit); if (result.ResponseCode == "00") { var subject = "Transaction Deleted for - " + InvoiceNo; var body = "Transaction Deleted for - " + InvoiceNo; body += "<br/><br/> Regards <br/> Blue Ocktopus Team"; SendEmail(GroupId, subject, body); } if (Convert.ToBoolean(IsSMS)) { //Logic to send SMS to Customer whose Name is changed } } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public SPResponse UpdateMobileOfMember(string GroupId, string CustomerId, string MobileNo, tblAudit objAudit) { SPResponse result = new SPResponse(); try { CustomerDetail objCustomerDetail = new CustomerDetail(); List <TransactionMaster> lstObjTxn = new List <TransactionMaster>(); List <PointsExpiry> lstobjpoints = new List <PointsExpiry>(); TransferPointsDetail objtransferPointsDetail = new TransferPointsDetail(); string connStr = objCustRepo.GetCustomerConnString(GroupId); using (var contextNew = new BOTSDBContext(connStr)) { var objExisting = contextNew.CustomerDetails.Where(x => x.MobileNo == MobileNo).FirstOrDefault(); if (objExisting == null) { objCustomerDetail = contextNew.CustomerDetails.Where(x => x.CustomerId == CustomerId).FirstOrDefault(); string oldno = objCustomerDetail.MobileNo; objCustomerDetail.MobileNo = MobileNo; lstObjTxn = contextNew.TransactionMasters.Where(x => x.CustomerId == CustomerId).Take(10000).ToList(); if (lstObjTxn != null) { foreach (var trans in lstObjTxn) { trans.MobileNo = MobileNo; contextNew.TransactionMasters.AddOrUpdate(trans); contextNew.SaveChanges(); } } lstobjpoints = contextNew.PointsExpiries.Where(x => x.CustomerId == CustomerId).Take(10000).ToList(); if (lstobjpoints != null) { foreach (var points in lstobjpoints) { points.MobileNo = MobileNo; contextNew.PointsExpiries.AddOrUpdate(points); contextNew.SaveChanges(); } } objtransferPointsDetail.NewMobileNo = MobileNo; objtransferPointsDetail.OldMobileNo = oldno; objtransferPointsDetail.GroupId = GroupId; objtransferPointsDetail.Datetime = DateTime.Now; objtransferPointsDetail.Points = objCustomerDetail.Points; contextNew.TransferPointsDetails.AddOrUpdate(objtransferPointsDetail); contextNew.SaveChanges(); contextNew.CustomerDetails.AddOrUpdate(objCustomerDetail); contextNew.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Mobile Number Updated Successfully"; } else { result.ResponseCode = "01"; result.ResponseMessage = "Mobile Number Already Exist"; } } using (var context = new CommonDBContext()) { context.tblAudits.Add(objAudit); context.SaveChanges(); } } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(result); }
public JsonResult AddBulkMemberData(string GroupId, HttpPostedFileBase file) { CustomerDetail objCustomer = new CustomerDetail(); SPResponse result = new SPResponse(); try { using (XLWorkbook workBook = new XLWorkbook(file.InputStream)) { IXLWorksheet workSheet = workBook.Worksheet(1); DataTable dt = new DataTable(); bool firstRow = true; foreach (IXLRow row in workSheet.Rows()) { if (firstRow) { foreach (IXLCell cell in row.Cells()) { if (!string.IsNullOrEmpty(cell.Value.ToString())) { dt.Columns.Add(cell.Value.ToString()); } else { break; } } firstRow = false; } else { int i = 0; DataRow toInsert = dt.NewRow(); foreach (IXLCell cell in row.Cells(1, dt.Columns.Count)) { try { toInsert[i] = cell.Value.ToString(); } catch (Exception ex) { } i++; } dt.Rows.Add(toInsert); } } if (dt.Rows.Count > 0) { int TotalRows = 0; int index = 0; int invalid = 0; foreach (DataRow dr in dt.Rows) { if (!string.IsNullOrEmpty(Convert.ToString(dr["MobileNo"]))) { Regex regex = new Regex(@"[0-9]{10}"); Match match = regex.Match(Convert.ToString(dr["MobileNo"])); if (match.Success) { objCustomer.CustomerName = Convert.ToString(dr["CustomerName"]); objCustomer.MobileNo = Convert.ToString(dr["MobileNo"]); result = ITOPS.AddBulkCustomerData(GroupId, objCustomer); if (result.ResponseCode == "00") { TotalRows++; } if (result.ResponseCode == "01") { index++; } } else { invalid++; } } } result.ResponseSucessCount = TotalRows.ToString(); result.ResponseFailCount = index.ToString(); result.ResponseInValidFormatCount = invalid.ToString(); } } } catch (Exception ex) { newexception.AddException(ex, GroupId); result.ResponseCode = "-1"; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult RedeemPointsData(string jsonData) { SPResponse result = new SPResponse(); string GroupId = ""; try { JavaScriptSerializer json_serializer = new JavaScriptSerializer(); json_serializer.MaxJsonLength = int.MaxValue; object[] objData = (object[])json_serializer.DeserializeObject(jsonData); tblAudit objAudit = new tblAudit(); bool IsSMS = false; string MobileNo = ""; string TransactionDate = ""; string InvoiceNumber = ""; string InvoiceAmount = ""; string OutletId = ""; string PointsToRedeem = ""; string TxnType = ""; foreach (Dictionary <string, object> item in objData) { GroupId = Convert.ToString(item["GroupID"]); MobileNo = Convert.ToString(item["MobileNo"]); OutletId = Convert.ToString(item["OutletId"]); TransactionDate = Convert.ToString(item["TransactionDate"]); InvoiceNumber = Convert.ToString(item["InvoiceNumber"]); InvoiceAmount = Convert.ToString(item["InvoiceAmount"]); PointsToRedeem = Convert.ToString(item["RedeemPoints"]); TxnType = Convert.ToString(item["TxnType"]); objAudit.GroupId = GroupId; objAudit.RequestedFor = "Redeem Point"; objAudit.RequestedEntity = "Mobile No - " + MobileNo; objAudit.RequestedBy = Convert.ToString(item["RequestedBy"]); objAudit.RequestedOnForum = Convert.ToString(item["RequestedForum"]); objAudit.RequestedOn = Convert.ToDateTime(item["RequestedOn"]); IsSMS = Convert.ToBoolean(item["IsSMS"]); } result = ITOPS.AddRedeemPointsData(GroupId, MobileNo, OutletId, Convert.ToDateTime(TransactionDate), DateTime.Now, InvoiceNumber, InvoiceAmount, Convert.ToDecimal(PointsToRedeem), Convert.ToString(IsSMS), TxnType, objAudit); if (result.ResponseCode == "00") { var subject = "Points Redeem for mobile no - " + MobileNo; var body = "Points Redeem for mobile no - " + MobileNo; body += "<br/><br/> Regards <br/> Blue Ocktopus Team"; SendEmail(GroupId, subject, body); } if (IsSMS) { //Logic to send SMS to Customer whose Name is changed } } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(Json(result, JsonRequestBehavior.AllowGet)); }