public SPResponse ActiveInactiveBillingPartner(int BillingpartnerId) { tblBillingPartner objbillingpartner = new tblBillingPartner(); SPResponse result = new SPResponse(); using (var context = new CommonDBContext()) { objbillingpartner = context.tblBillingPartners.Where(x => x.BillingPartnerId == BillingpartnerId).FirstOrDefault(); if (objbillingpartner.IsActive == true) { objbillingpartner.IsActive = false; } else { objbillingpartner.IsActive = true; } context.tblBillingPartners.AddOrUpdate(objbillingpartner); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Billing Partner Updated Successfully"; } return(result); }
public ActionResult AddBillingPartner(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); tblBillingPartner objbillingpartner = new tblBillingPartner(); foreach (Dictionary <string, object> item in objData) { objbillingpartner.BillingPartnerName = Convert.ToString(item["BillingPartnerNm"]); objbillingpartner.CreatedBy = userDetails.LoginId; objbillingpartner.CreatedDate = DateTime.Now; BillingPartnerId = Convert.ToString(item["BillingPartnerId"]); objbillingpartner.IsActive = Convert.ToBoolean(item["IsActive"]); if (BillingPartnerId != "") { objbillingpartner.BillingPartnerId = Convert.ToInt32(BillingPartnerId); } else { } } result = COR.AddBillingPartner(objbillingpartner); } catch (Exception ex) { } return(Json(result, JsonRequestBehavior.AllowGet)); }
public tblBillingPartner GetBillingPartnerById(int BillingpartnerId) { tblBillingPartner objbillingpartner = new tblBillingPartner(); using (var context = new CommonDBContext()) { objbillingpartner = context.tblBillingPartners.Where(x => x.BillingPartnerId == BillingpartnerId).FirstOrDefault(); } return(objbillingpartner); }
public ActionResult GetBillingPartner(int BillingpartnerId) { tblBillingPartner objbillingpartner = new tblBillingPartner(); try { objbillingpartner = COR.GetBillingPartnerById(BillingpartnerId); } catch (Exception ex) { } return(Json(objbillingpartner, JsonRequestBehavior.AllowGet)); }
public SPResponse AddBillingPartner(tblBillingPartner objtblbillingpartner) { SPResponse result = new SPResponse(); try { using (var context = new CommonDBContext()) { context.tblBillingPartners.AddOrUpdate(objtblbillingpartner); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Billing Partner Added Successfully"; } } catch (Exception ex) { newexception.AddException(ex, "onboarding_master"); } return(result); }
public int AddGroupDetails(tblGroupDetail objGroupDetails) { int GroupId = 0; using (var context = new CommonDBContext()) { using (DbContextTransaction transaction = context.Database.BeginTransaction()) { try { if (!string.IsNullOrEmpty(objGroupDetails.OtherBillingPartner)) { tblBillingPartner objBillingPartner = new tblBillingPartner(); objBillingPartner.BillingPartnerName = objGroupDetails.OtherBillingPartner; context.tblBillingPartners.AddOrUpdate(objBillingPartner); context.SaveChanges(); objGroupDetails.BillingPartner = objBillingPartner.BillingPartnerId; } if (!string.IsNullOrEmpty(objGroupDetails.OtherCity)) { tblCity objCity = new tblCity(); objCity.CityName = objGroupDetails.OtherCity; context.tblCities.AddOrUpdate(objCity); context.SaveChanges(); objGroupDetails.City = objCity.CityId; } if (!string.IsNullOrEmpty(objGroupDetails.OtherRetailCategory)) { tblCategory objCategory = new tblCategory(); objCategory.CategoryName = objGroupDetails.OtherRetailCategory; context.tblCategories.AddOrUpdate(objCategory); context.SaveChanges(); objGroupDetails.RetailCategory = objCategory.CategoryId; } if (!string.IsNullOrEmpty(objGroupDetails.OtherRMAssigned)) { tblRMAssigned objRMAssigned = new tblRMAssigned(); objRMAssigned.RMAssignedName = objGroupDetails.OtherRMAssigned; context.tblRMAssigneds.AddOrUpdate(objRMAssigned); context.SaveChanges(); objGroupDetails.RMAssigned = objRMAssigned.RMAssignedId; } if (!string.IsNullOrEmpty(objGroupDetails.OtherSourcedBy)) { tblSourcedBy objSourcedBy = new tblSourcedBy(); objSourcedBy.SourcedbyName = objGroupDetails.OtherSourcedBy; context.tblSourcedBies.AddOrUpdate(objSourcedBy); context.SaveChanges(); objGroupDetails.SourcedBy = objSourcedBy.SourcedbyId; } if (!string.IsNullOrEmpty(objGroupDetails.Logo)) { //Upload Logo Image var profilePhysicalURL = System.Configuration.ConfigurationManager.AppSettings["LogoPhysicalURL"]; string filePhysicalPath = System.IO.Path.Combine(profilePhysicalURL + "\\"); string base64String = Convert.ToString(objGroupDetails.LogoBase64); byte[] newBytes = Convert.FromBase64String(base64String); MemoryStream ms = new MemoryStream(newBytes, 0, newBytes.Length); ms.Write(newBytes, 0, newBytes.Length); var fileName = Convert.ToString(objGroupDetails.GroupId + ".jpg"); FileStream fileNew = new FileStream(filePhysicalPath + "\\" + fileName, FileMode.Create, FileAccess.Write); ms.WriteTo(fileNew); fileNew.Close(); ms.Close(); objGroupDetails.Logo = fileName; } string grpId = Convert.ToString(objGroupDetails.GroupId); //Check Customer DB exist var DBDetails = context.DatabaseDetails.Where(x => x.GroupId == grpId).FirstOrDefault(); if (DBDetails == null) { //Create Customer DB And Add Entry to DatabaseDetails Table var LastGroupId = context.tblGroupDetails.OrderByDescending(x => x.GroupId).Take(1).Select(y => y.GroupId).FirstOrDefault(); objGroupDetails.GroupId = LastGroupId + 1; } context.tblGroupDetails.AddOrUpdate(objGroupDetails); context.SaveChanges(); transaction.Commit(); GroupId = objGroupDetails.GroupId; } catch (Exception ex) { transaction.Rollback(); throw ex; } } } return(GroupId); }