Beispiel #1
0
        public ActionResult Index(Point model, FormCollection form)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string statusDDLValue = form["Statusddl"].ToString();

                    //var clientId= entity.InsertUpdateSelectAdmin(0, model.name, model.Address, model.MobileNo, model.EmailId, genderDDLValue, model.dob, model.countryId, model.stateId, model.cityId, 1, );
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        var points = new LMS_Datas.Point()
                        {
                            Points = model.Points,
                            Amount = model.Amount,
                            Active = Boolean.Parse(statusDDLValue)
                        };
                        context.Points.Add(points);

                        //context.ClientDetails.Add(clientDetails);
                        //etc add your other classes
                        context.SaveChanges();
                    }
                    ViewBag.alert = "Success";
                    return(View());
                }
                ViewBag.alert = "Error";
                return(View(model));
            }
            catch (Exception e1)
            {
                ViewBag.alert = "Error";
                return(View());
            }
        }
 public ActionResult Index(Card1 model, FormCollection form)
 {
     try
     {
         ViewBag.Packages = new SelectList(entity.Packages.Where(models => models.Active == true), "PackagesId", "PackageName");
         string statusDDLValue  = form["Statusddl"].ToString();
         string packageDDLValue = form["PackagesId"].ToString();
         if (ModelState.IsValid)
         {
             using (var context = new LoyaltyManagementSystemEntities())
             {
                 var addCard = new LMS_Datas.Card1()
                 {
                     CardName    = model.CardName,
                     persons     = model.persons,
                     discountPer = model.discountPer,
                     ValidFrom   = model.ValidFrom,
                     ValidTo     = model.ValidTo,
                     Activate    = Boolean.Parse(statusDDLValue),
                     PackagesId  = Convert.ToInt32(packageDDLValue)
                 };
                 context.Card1.Add(addCard);
                 context.SaveChanges();
                 ViewBag.alert = "Success";
             }
         }
         return(View());
     }
     catch (Exception e1)
     {
         ViewBag.alert = "Error";
         return(View());
     }
 }
 public ActionResult Index(PayMode model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (var context = new LoyaltyManagementSystemEntities())
             {
                 var payMode = new LMS_Datas.PayMode()
                 {
                     PayMode1 = model.PayMode1,
                     Active   = true
                 };
                 context.PayModes.Add(payMode);
                 context.SaveChanges();
             }
         }
         ViewBag.alert = "Success";
         return(View());
     }
     catch (Exception e1)
     {
         ViewBag.alert = "Error";
         return(View());
     }
 }
 public ActionResult Index(Discountper model, FormCollection form)
 {
     try
     {
         if (ModelState.IsValid)
         {
             string statusDDLValue = form["Statusddl"].ToString();
             //var clientId= entity.InsertUpdateSelectAdmin(0, model.name, model.Address, model.MobileNo, model.EmailId, genderDDLValue, model.dob, model.countryId, model.stateId, model.cityId, 1, );
             using (var context = new LoyaltyManagementSystemEntities())
             {
                 var discountper = new LMS_Datas.Discountper()
                 {
                     Persons      = model.Persons,
                     DiscountRate = model.DiscountRate,
                     Activate     = Boolean.Parse(statusDDLValue)
                 };
                 context.Discountpers.Add(discountper);
                 context.SaveChanges();
             }
             ViewBag.alert = "Success";
             return(View());
         }
         ViewBag.alert = "Error";
         return(View(model));
     }
     catch (Exception e1)
     {
         ViewBag.alert = "Error";
         return(View());
     }
 }
Beispiel #5
0
 public ActionResult Index(CustomerViewModel model, FormCollection form, HttpPostedFileBase files)
 {
     try
     {
         if (ModelState.IsValid)
         {
             string statusDDLValue = form["Statusddl"].ToString();
             string genderDDLValue = form["genderddl"].ToString();
             using (var context = new LoyaltyManagementSystemEntities())
             {
                 var customer = new LMS_Datas.Customer()
                 {
                     Name      = model.CustomerName,
                     Address   = model.Address,
                     dob       = model.dob,
                     EmailId   = model.EmailId,
                     MobileNo  = model.MobileNo,
                     gender    = genderDDLValue,
                     countryId = model.countryId,
                     stateId   = model.stateId,
                     cityId    = model.cityId,
                     Active    = Boolean.Parse(statusDDLValue)
                 };
                 context.Customers.Add(customer);
                 context.SaveChanges();
                 customer.CustomerId = customer.CustomerId;
                 var CustomerLogin = new LMS_Datas.Login()
                 {
                     UserId   = customer.CustomerId,
                     UserName = model.UserName,
                     Password = model.Password,
                     Activate = "true",
                     Role     = "Customer"
                 };
                 context.Logins.Add(CustomerLogin);
                 context.SaveChanges();
                 if (files.FileName != null)
                 {
                     var    ext    = Path.GetExtension(files.FileName);
                     string myfile = customer.CustomerId + ext;
                     var    path   = Path.Combine(Server.MapPath("~/Images/CustomerProfile"), myfile);
                     files.SaveAs(path);
                 }
             }
         }
         ViewBag.CountryDd = new SelectList(entity.countries.Where(models => models.Active == true), "countryId", "countryName");
         ViewBag.alert     = "Success";
         return(View());
     }
     catch (Exception e1)
     {
         ViewBag.CountryDd = new SelectList(entity.countries.Where(models => models.Active == true), "countryId", "countryName");
         ViewBag.alert     = "Error";
         return(View());
     }
 }
Beispiel #6
0
        public JsonResult GetStateDdl(string countryId)
        {
            //List<city> lstcity = new List<city>();
            int id = Convert.ToInt32(countryId);

            using (LoyaltyManagementSystemEntities db = new LoyaltyManagementSystemEntities())
            {
                IEnumerable lststate = (db.states.Where(x => x.countryId == id)).Select(o => new
                {
                    Stateid   = o.stateId,
                    StateName = o.stateName
                }).ToList();

                return(Json(lststate, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult Index(CustomerVoucher model, FormCollection form)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string customerName = (from e in entity.Customers where e.CustomerId == model.CustomerId select e.Name).First().ToString();
                    string mobileNumber = (from e in entity.Customers where e.CustomerId == model.CustomerId select e.MobileNo).First().ToString();
                    mobileNumber = mobileNumber.Replace("(", String.Empty);
                    mobileNumber = mobileNumber.Replace(")", String.Empty);
                    mobileNumber = mobileNumber.Replace("-", String.Empty);
                    mobileNumber = mobileNumber.Replace(" ", String.Empty);
                    string vouchername = (from e in entity.Vouchers where e.VoucherId == model.VoucherId select e.VoucherName).First().ToString();
                    string mailId      = (from e in entity.Customers where e.CustomerId == model.CustomerId select e.EmailId).First().ToString();
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        var addCustomerVoucher = new LMS_Datas.CustomerVoucher()
                        {
                            CustomerId = model.CustomerId,
                            VoucherId  = model.VoucherId,
                            AssignNo   = model.AssignNo,
                            AssignOn   = DateTime.Now,
                            Active     = true
                        };
                        context.CustomerVouchers.Add(addCustomerVoucher);

                        //context.ClientDetails.Add(clientDetails);
                        //etc add your other classes
                        context.SaveChanges();
                    }
                    ViewBag.CustomerId = new SelectList(entity.Customers.Where(models => models.Active == true), "CustomerId", "Name");
                    ViewBag.VoucherId  = new SelectList(entity.Vouchers.Where(models => models.Activate == true), "VoucherId", "VoucherName");
                    ViewBag.alert      = "Success";
                    builder.Append("Hello " + customerName + ",").AppendLine();
                    builder.Append("Voucher " + vouchername + " is assigned to you. Use Voucher No. " + model.AssignNo + " for further references.").AppendLine();
                    builder.Append("Thanks");
                    //sms.send(mobileNumber, builder);
                    sms.send("8285601519", builder);
                    Mail.send(builder, "*****@*****.**", "*****@*****.**", "Voucher Assigned");
                }
            }
            catch (Exception e1)
            {
                ViewBag.alert = "Error";
            }
            return(View());
        }
        public ActionResult Index(TransferVoucher model)
        {
            try
            {
                ViewBag.TransferTo   = new SelectList(entity.Customers.Where(models => models.Active == true), "CustomerId", "Name");
                ViewBag.TransferFrom = new SelectList(entity.Customers.Where(models => models.Active == true), "CustomerId", "Name");
                ViewBag.VoucherDd    = new SelectList(entity.Vouchers.Where(models => models.Activate == true), "VoucherId", "VoucherName");
                if (ModelState.IsValid)
                {
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        var transferVoucher = new LMS_Datas.TransferVoucher()
                        {
                            TransferFromCustomerID = model.TransferFromCustomerID,
                            TransferToCustomerID   = model.TransferToCustomerID,
                            VoucherID   = model.VoucherID,
                            TranferDate = DateTime.Now
                        };
                        context.TransferVouchers.Add(transferVoucher);
                        context.SaveChanges();
                        ViewBag.alert = "Success";
                        string TransferFrom = (from e in entity.Customers where e.CustomerId == model.TransferFromCustomerID select e.Name).First().ToString();
                        string TransferTo   = (from e in entity.Customers where e.CustomerId == model.TransferToCustomerID select e.Name).First().ToString();
                        string vouchername  = (from e in entity.Vouchers where e.VoucherId == model.VoucherID select e.VoucherName).First().ToString();
                        string voucherno    = (from e in entity.CustomerVouchers where e.VoucherId == model.VoucherID select e.AssignNo).First().ToString();
                        string mobileNumber = (from e in entity.Customers where e.CustomerId == model.TransferToCustomerID select e.MobileNo).First().ToString();
                        mobileNumber = mobileNumber.Replace(")", String.Empty);
                        mobileNumber = mobileNumber.Replace("-", String.Empty);
                        mobileNumber = mobileNumber.Replace(" ", String.Empty);
                        builder.Append("Hello " + TransferTo + ",").AppendLine();
                        builder.Append("Voucher " + vouchername + " is Transferred to you by " + TransferFrom + ". Use Voucher No. " + voucherno + " for further references.").AppendLine();

                        builder.Append("Thanks");
                        //sms.send(mobileNumber, builder);
                        sms.send("8285601519", builder);
                        Mail.send(builder, "*****@*****.**", "*****@*****.**", "Voucher Assigned");
                    }
                }
                return(View());
            }
            catch (Exception e1)
            {
                ViewBag.alert = "Error";
                return(View());
            }
        }
Beispiel #9
0
        public ActionResult Index(LMS_Datas.Desk model, FormCollection form, HttpPostedFileBase files)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        var addDesk = new LMS_Datas.Desk()
                        {
                            DeskName = model.DeskName,
                            Password = model.Password,
                            DeskNo   = model.DeskNo,
                            Active   = model.Active,
                            UserName = model.UserName
                        };
                        context.Desks.Add(addDesk);

                        context.SaveChanges();

                        if (files.FileName != null)
                        {
                            var    ext    = Path.GetExtension(files.FileName);
                            string myfile = addDesk.DeskId + ext;
                            var    path   = Path.Combine(Server.MapPath("~/Images/DeskProfile"), myfile);
                            files.SaveAs(path);
                        }
                    }
                    ViewBag.alert = "Success";
                    return(View());
                }
                ViewBag.alert = "Error";
                return(View(model));
            }
            catch (Exception e1)
            {
                ViewBag.alert = "Error";
                return(View());
            }
        }
Beispiel #10
0
        public ActionResult Index(Voucher model, FormCollection form)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string statusDDLValue = form["Statusddl"].ToString();
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        var addVoucher = new LMS_Datas.Voucher()
                        {
                            Activate    = true,
                            description = model.description,
                            Discountper = model.Discountper,
                            ValidFrom   = model.ValidFrom,
                            ValidTo     = model.ValidTo,
                            VoucherName = model.VoucherName,
                            PackagesId  = model.PackagesId,
                            persons     = model.persons
                        };
                        context.Vouchers.Add(addVoucher);

                        //context.ClientDetails.Add(clientDetails);
                        //etc add your other classes
                        context.SaveChanges();
                    }
                    ViewBag.PackageDd = new SelectList(entity.Packages.Where(models => models.Active == true), "PackagesId", "PackageName");
                    ViewBag.alert     = "Success";
                }
            }
            catch (Exception e1)
            {
                ViewBag.alert = "Error";
            }
            return(View());
        }
        public static Login GetUserDetails(User user)
        {
            LoyaltyManagementSystemEntities entity = new LoyaltyManagementSystemEntities();

            return((entity.Logins.Where(u => u.UserName.ToLower() == user.UserName.ToLower() && u.Password == user.Password)).FirstOrDefault());
        }
        public ActionResult Index(AdminViewModel model, FormCollection form, HttpPostedFileBase files)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string statusDDLValue = form["Statusddl"].ToString();
                    string genderDDLValue = form["genderddl"].ToString();

                    //var clientId= entity.InsertUpdateSelectAdmin(0, model.name, model.Address, model.MobileNo, model.EmailId, genderDDLValue, model.dob, model.countryId, model.stateId, model.cityId, 1, );
                    using (var context = new LoyaltyManagementSystemEntities())
                    {
                        // Client is Admin
                        var admin = new LMS_Datas.Admin()
                        {
                            Name      = model.ClientName,
                            Address   = model.Address,
                            dob       = model.dob,
                            EmailId   = model.EmailId,
                            MobileNo  = model.MobileNo,
                            gender    = genderDDLValue,
                            countryId = model.countryId,
                            stateId   = model.stateId,
                            cityId    = model.cityId,
                            Active    = Boolean.Parse(statusDDLValue)
                        };
                        context.Admins.Add(admin);

                        //context.ClientDetails.Add(clientDetails);
                        //etc add your other classes
                        context.SaveChanges();
                        admin.AdminId = admin.AdminId;

                        var adminLogin = new LMS_Datas.Login()
                        {
                            LoginId  = admin.AdminId,
                            UserName = model.UserName,
                            Role     = "Client",
                            Password = model.Password
                        };
                        context.Logins.Add(adminLogin);
                        context.SaveChanges();
                        if (files.FileName != null)
                        {
                            var    ext    = Path.GetExtension(files.FileName);
                            string myfile = admin.AdminId + ext;
                            var    path   = Path.Combine(Server.MapPath("~/Images/ClientProfile"), myfile);
                            files.SaveAs(path);
                        }
                    }
                    ViewBag.CountryDd = new SelectList(entity.countries.Where(models => models.Active == true), "countryId", "countryName");
                    ViewBag.alert     = "Success";
                    return(View());
                }
                ViewBag.CountryDd = new SelectList(entity.countries.Where(models => models.Active == true), "countryId", "countryName");
                ViewBag.alert     = "Error";
                return(View(model));
            }
            catch (Exception e1)
            {
                ViewBag.CountryDd = new SelectList(entity.countries.Where(models => models.Active == true), "countryId", "countryName");
                ViewBag.alert     = "Error";
                return(View());
            }
        }