コード例 #1
0
        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);
        }
コード例 #2
0
        public ActionResult AddRM(string jsonData)
        {
            SPResponse result      = new SPResponse();
            var        userDetails = (CustomerLoginDetail)Session["UserSession"];
            string     CSId        = "";

            try
            {
                JavaScriptSerializer json_serializer = new JavaScriptSerializer();
                json_serializer.MaxJsonLength = int.MaxValue;
                object[]      objData = (object[])json_serializer.DeserializeObject(jsonData);
                tblRMAssigned objRM   = new tblRMAssigned();
                foreach (Dictionary <string, object> item in objData)
                {
                    objRM.RMAssignedName = Convert.ToString(item["CSNm"]);
                    objRM.CreatedBy      = userDetails.LoginId;
                    objRM.CreatedDate    = DateTime.Now;
                    CSId           = Convert.ToString(item["CSId"]);
                    objRM.IsActive = Convert.ToBoolean(item["IsActive"]);
                    if (CSId != "")
                    {
                        objRM.RMAssignedId = Convert.ToInt32(CSId);
                    }
                    else
                    {
                    }
                }
                result = COR.AddRM(objRM);
            }
            catch (Exception ex)
            {
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public tblRMAssigned GetRMById(int RMId)
        {
            tblRMAssigned objRM = new tblRMAssigned();

            using (var context = new CommonDBContext())
            {
                objRM = context.tblRMAssigneds.Where(x => x.RMAssignedId == RMId).FirstOrDefault();
            }
            return(objRM);
        }
コード例 #4
0
        public ActionResult GetRM(int RMId)
        {
            tblRMAssigned objRM = new tblRMAssigned();

            try
            {
                objRM = COR.GetRMById(RMId);
            }
            catch (Exception ex)
            {
            }
            return(Json(objRM, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }