コード例 #1
0
        public string PostMyPage(Customer_Information MyInfo)
        {
            if (MyInfo != null)
            {
                try
                {
                    Customer_Information a = Data.Customer_Information.Single(x => x.Customer_id == MyInfo.Customer_id);

                    a.Name     = MyInfo.Name;
                    a.Address  = MyInfo.Address;
                    a.Phone    = MyInfo.Phone;
                    a.Email    = MyInfo.Email;
                    a.Type     = MyInfo.Type;
                    a.User_id  = MyInfo.User_id;
                    a.Password = MyInfo.Password;

                    Data.Entry(a).State = EntityState.Modified;


                    return("Informations are Updated Successfully.");
                }

                catch

                {
                    return("Informations are  Not Updated. Please Try Later");
                }
            }

            else
            {
                return("Informations are  Not Updated. Please Try Later");
            }
        }
コード例 #2
0
        public string Edit(string customer_id, int?id)
        {
            try
            {
                Customer_Order Data_Amdani = Data.Customer_Order.Single(Z => Z.Id == id && Z.Purches_id == customer_id && Z.Order_Status == 1);

                if (Data_Amdani.Unit_name == "PACKAGE")
                {
                    return("Sorry !! You cant get More then 1 Package");
                }


                else
                {
                    Data_Amdani.Unit_number++;
                    Data.Entry(Data_Amdani).State = EntityState.Modified;
                    Data.SaveChanges();
                    return(Data_Amdani.Product_Name + " is successfully Incrimented.");
                }
            }

            catch
            {
                return("Missing Data");
            }
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "Id,Name,Parent_id")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
コード例 #4
0
ファイル: OfferClass.cs プロジェクト: pori468/HatBazar
        public List <Campaign> Index()
        {
            List <Campaign> campaign = Data.Campaign.ToList();


            foreach (var i in campaign)
            {
                //if (!Utility.CompareDate(null, i.Validity_End))
                //{
                if (Utility.CompareDate(i.Validity, null))
                {
                    i.Validation        = 0;
                    Data.Entry(i).State = EntityState.Modified;
                    Data.SaveChanges();
                }



                //}
            }
            return(Data.Campaign.Where(x => x.Validation == 1).ToList());
        }
コード例 #5
0
ファイル: ReportClass.cs プロジェクト: pori468/HatBazar
        public int Product(OfferModel MyData)
        {
            DateTime start = Convert.ToDateTime(MyData.startdate + "/" + MyData.startmonth + "/" + MyData.startyear);
            DateTime end   = Convert.ToDateTime(MyData.Enddate + "/" + MyData.Endmonth + "/" + MyData.Endyear);

            //var dateOnlyString = MyData.StartDate.ToShortDateString(); //Return 00/00/0000
            //DateTime start = Convert.ToDateTime(dateOnlyString);

            //dateOnlyString = MyData.EndDate.ToShortDateString(); //Return 00/00/0000
            //DateTime end = Convert.ToDateTime(dateOnlyString);
            if (Utility.CompareDate((end.Date).ToString(), (start.Date).ToString()))
            {
                List <Product_SellingDate> Product = Data.Product_SellingDate.ToList();
                foreach (var i in Product)
                {
                    i.Selected          = 0;
                    Data.Entry(i).State = EntityState.Modified;
                    Data.SaveChanges();
                    if (Utility.CompareDate((end.Date).ToString(), i.Date))
                    {
                        if (Utility.CompareDate(i.Date, (start.Date).ToString()))
                        {
                            i.Selected          = 1;
                            Data.Entry(i).State = EntityState.Modified;
                            Data.SaveChanges();
                        }
                    }
                }

                return(1);
            }
            else
            {
                return(0);
            }

            //return 0;
        }
コード例 #6
0
        public string PostEdit(Job_Application job)
        {
            try
            {
                Data.Entry(job).State = EntityState.Modified;
                Data.SaveChanges();
                return("Index");
            }

            catch
            {
                throw;
            }
        }
コード例 #7
0
        public List <Customer_Complain> PostShowComplain(int id)
        {
            try
            {
                Customer_Complain C = Data.Customer_Complain.Single(x => x.Id == id);
                C.Status            = "Done";
                Data.Entry(C).State = EntityState.Modified;
                Data.SaveChanges();
                List <Customer_Complain> Comp = Data.Customer_Complain.ToList();
                return(Comp);
            }

            catch
            {
                throw;
            }
        }
コード例 #8
0
        public string Addtocart(int?id, string Customerid)
        {
            if (id != null)
            {
                try
                {
                    Product_Information product_Information = new Product_Information();
                    product_Information = Data.Product_Information.Single(x => x.Product_id == id);
                    bool Check = Data.Customer_Order.Any(x => x.Product_id == product_Information.Product_id && x.Purches_id == Customerid && x.Order_Status == 1);
                    if (Check == true)
                    {
                        Customer_Order Data_Amdani = Data.Customer_Order.Single(x => x.Product_id == product_Information.Product_id && x.Purches_id == Customerid && x.Order_Status == 1);

                        Data_Amdani.Unit_number++;
                        Data.Entry(Data_Amdani).State = EntityState.Modified;
                    }
                    else
                    {
                        Customer_Order CO = new Customer_Order();
                        CO.Product_Name = product_Information.Product_name;
                        CO.Unit_name    = product_Information.Unit;
                        CO.Unit_number  = 1;
                        CO.Price        = product_Information.Price_per_unit;
                        CO.Product_id   = product_Information.Product_id;
                        CO.Purches_id   = Customerid;
                        CO.Order_Status = 1;

                        Data.Customer_Order.Add(CO);
                    }

                    Data.SaveChanges();


                    return(product_Information.Product_name + "" + " Added Successfully.");
                }


                catch
                {
                    throw;
                }
            }
            else
            {
                return("Product could not be Added.");
            }
        }