public string EditPayment(PayMode Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedPaymentValue = new LMS_Datas.PayMode
                    {
                        Active    = true,
                        PayModeId = Model.PayModeId,
                        PayMode1  = Model.PayMode1
                    };

                    entity.PayModes.Attach(enditedPaymentValue);
                    entity.Entry(enditedPaymentValue).Property(x => x.PayMode1).IsModified = true;
                    entity.Entry(enditedPaymentValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
        public string EditCustomerVoucher(CustomerVoucher Model, FormCollection form)
        {
            string statusDDLValue = form["VoucherName"].ToString();
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedCustomerVoucherValue = new LMS_Datas.CustomerVoucher
                    {
                        Active     = true,
                        CustomerId = Model.CustomerId,
                        VoucherId  = Model.VoucherId,
                        AssignNo   = Model.AssignNo
                    };

                    entity.CustomerVouchers.Attach(enditedCustomerVoucherValue);

                    entity.Entry(enditedCustomerVoucherValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
        // Admin is Client Here
        public string EditClient(AdminViewModel Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedAdminValue = new LMS_Datas.Admin
                    {
                        Active   = true,
                        AdminId  = Model.AdminId,
                        Address  = Model.Address,
                        EmailId  = Model.EmailId,
                        dob      = Model.dob,
                        Name     = Model.ClientName,
                        MobileNo = Model.MobileNo
                    };

                    entity.Admins.Attach(enditedAdminValue);
                    entity.Entry(enditedAdminValue).Property(x => x.cityId).IsModified    = false;
                    entity.Entry(enditedAdminValue).Property(x => x.stateId).IsModified   = false;
                    entity.Entry(enditedAdminValue).Property(x => x.dob).IsModified       = false;
                    entity.Entry(enditedAdminValue).Property(x => x.gender).IsModified    = false;
                    entity.Entry(enditedAdminValue).Property(x => x.countryId).IsModified = false;
                    entity.Entry(enditedAdminValue).Property(x => x.Name).IsModified      = true;
                    entity.Entry(enditedAdminValue).Property(x => x.EmailId).IsModified   = true;
                    entity.Entry(enditedAdminValue).Property(x => x.MobileNo).IsModified  = true;
                    //entity.Entry(enditedValue).State = EntityState.Modified;
                    entity.SaveChanges();

                    int?loginid = (from loginId in entity.Logins where loginId.UserId == Model.AdminId select loginId.UserId).FirstOrDefault();
                    var enditedAdminLoginValue = new Login
                    {
                        UserName = Model.UserName,
                        Password = Model.Password,
                        UserId   = loginid,
                        Activate = "true"
                    };

                    entity.Logins.Attach(enditedAdminLoginValue);
                    entity.Entry(enditedAdminLoginValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
        public string EditDiscount(Discountper Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedDiscountValue = new LMS_Datas.Discountper
                    {
                        DiscountRate  = Model.DiscountRate,
                        Persons       = Model.Persons,
                        Activate      = true,
                        DiscountPerId = Model.DiscountPerId
                    };

                    entity.Discountpers.Attach(enditedDiscountValue);
                    entity.Entry(enditedDiscountValue).Property(x => x.DiscountPerId).IsModified = true;
                    entity.Entry(enditedDiscountValue).Property(x => x.Activate).IsModified      = true;
                    entity.Entry(enditedDiscountValue).Property(x => x.Persons).IsModified       = true;
                    entity.Entry(enditedDiscountValue).Property(x => x.DiscountRate).IsModified  = true;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
        public string DeleteCard(int id)
        {
            string msg;

            try
            {
                var enditedDiscountper = new LMS_Datas.Card1
                {
                    CardId   = id,
                    Activate = false
                };
                entity.Card1.Attach(enditedDiscountper);
                //entity.Entry(enditedDiscountper).Property(x => x.CardId).IsModified = true;
                entity.Entry(enditedDiscountper).Property(x => x.Activate).IsModified           = true;
                entity.Entry(enditedDiscountper).Property(x => x.CardName).IsModified           = false;
                entity.Entry(enditedDiscountper).Property(x => x.ValidFrom).IsModified          = false;
                entity.Entry(enditedDiscountper).Property(x => x.ValidTo).IsModified            = false;
                entity.Entry(enditedDiscountper).Property(x => x.persons).IsModified            = false;
                entity.Entry(enditedDiscountper).Property(x => x.discountPer).IsModified        = false;
                entity.Entry(enditedDiscountper).Property(x => x.TransactionDetails).IsModified = false;
                entity.SaveChanges();
                msg = "Delete Successfully";
                return(msg);
            }
            catch (Exception e1)
            {
                msg = "Validation data not successfully";
                return(msg);
            }
        }
Exemplo n.º 6
0
        public string EditPackage(Point Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedPointsValue = new LMS_Datas.Point
                    {
                        Active   = true,
                        Points   = Model.Points,
                        Amount   = Model.Amount,
                        PointsId = Model.PointsId
                    };

                    entity.Points.Attach(enditedPointsValue);
                    entity.Entry(enditedPointsValue).Property(x => x.Active).IsModified   = true;
                    entity.Entry(enditedPointsValue).Property(x => x.Points).IsModified   = true;
                    entity.Entry(enditedPointsValue).Property(x => x.PointsId).IsModified = true;
                    entity.Entry(enditedPointsValue).Property(x => x.Amount).IsModified   = true;
                    //entity.Entry(enditedPackageValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
Exemplo n.º 7
0
        public string EditCustomerCard(CustomerCard Model, FormCollection form)
        {
            string CustomerName = form["CustomerName"].ToString();
            string CardName     = form["CardName"].ToString();
            string referenceNo  = form["ReferenceNo"].ToString();
            int    id           = Convert.ToInt16(form["id"].ToString());
            int    customerId   = (from customer in entity.Customers where customer.Name == CustomerName select customer.CustomerId).FirstOrDefault();
            int    CardId       = (from card in entity.Card1 where card.CardName == CardName select card.CardId).FirstOrDefault();
            string msgClient    = null;

            if (customerId != 0 && CardId != 0)
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        var enditedCustomerCardValue = new LMS_Datas.CustomerCard
                        {
                            CustomerId     = customerId,
                            Cardid         = CardId,
                            referenceNo    = referenceNo,
                            CustomerCardId = id
                        };

                        entity.CustomerCards.Attach(enditedCustomerCardValue);
                        entity.Entry(enditedCustomerCardValue).State = EntityState.Modified;
                        entity.SaveChanges();
                        msgClient = "Saved Successfully";
                    }
                    else
                    {
                        msgClient = "Validation data not successfully";
                    }
                }
                catch (Exception ex)
                {
                    msgClient = "Error in Retriving Data";
                }
            }
            else
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }
Exemplo n.º 8
0
        public string EditCountry(country Model)
        {
            string msg;

            try
            {
                if (ModelState.IsValid)
                {
                    entity.Entry(Model).State = EntityState.Modified;
                    entity.SaveChanges();
                    msg = "Saved Successfully";
                }
                else
                {
                    msg = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msg = "Error occured:" + ex.Message;
            }
            return(msg);
        }
Exemplo n.º 9
0
        // Admin is Client Here
        public string EditVoucher(Voucher Model)
        {
            string msgClient;

            try
            {
                if (ModelState.IsValid)
                {
                    var enditedVoucherValue = new LMS_Datas.Voucher
                    {
                        Activate    = true,
                        VoucherName = Model.VoucherName,
                        description = Model.description,
                        ValidFrom   = Model.ValidFrom,
                        ValidTo     = Model.ValidTo,
                        VoucherId   = Model.VoucherId,
                        persons     = Model.persons
                    };

                    entity.Vouchers.Attach(enditedVoucherValue);

                    entity.Entry(enditedVoucherValue).State = EntityState.Modified;
                    entity.SaveChanges();
                    msgClient = "Saved Successfully";
                }
                else
                {
                    msgClient = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msgClient = "Error in Retriving Data";
            }
            return(msgClient);
        }