예제 #1
0
        public ActionResult Create([Bind(Include = "Id,Name,Parent_id")] Category category)
        {
            if (ModelState.IsValid)
            {
                db.Category.Add(category);
                db.SaveChanges();
                return(RedirectToAction("Index", "Product_Information"));
            }

            return(View(category));
        }
예제 #2
0
 public string PostDelete(int?id)
 {
     try
     {
         Customer_Information customer_Information = Data.Customer_Information.Find(id);
         Data.Customer_Information.Remove(customer_Information);
         Data.SaveChanges();
         return("Index");
     }
     catch
     {
         throw;
     }
 }
예제 #3
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");
            }
        }
예제 #4
0
        public string Create(ProductModel product_Information)
        {
            try
            {
                Product_Information P = new Product_Information();
                P.Product_name   = product_Information.Product_name;
                P.Unit           = product_Information.Unit;
                P.Price_per_unit = product_Information.price_per_unit;
                P.Tag            = product_Information.tag;
                P.Special_Offer  = 0;
                P.Category_id    = product_Information.catagory;

                Data.Product_Information.Add(P);
                Data.SaveChanges();


                Image image = new Image {
                    ID = P.Product_id, Image1 = product_Information.Image
                };

                Data.Image.Add(image);
                Data.SaveChanges();



                Product_Stock PS = new Product_Stock {
                    Product_id   = P.Product_id, Stock_unit = product_Information.stock,
                    Product_Name = product_Information.Product_name
                };


                Data.Product_Stock.Add(PS);
                Data.SaveChanges();

                Category C = new Category();
                C.Id        = product_Information.product_id;
                C.Name      = product_Information.Product_name;
                C.Parent_id = product_Information.catagory;
                Data.Category.Add(C);
                Data.SaveChanges();


                return("Index");
            }
            catch
            {
                throw;
            }
        }
예제 #5
0
        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 Create(JobApplication myform)
        {
            try
            {
                Job_Application apply = new Job_Application();

                System.Random rand   = new System.Random((int)System.DateTime.Now.Ticks);
                int           random = rand.Next(1, 100000000);

                apply.Application_id = random.ToString();   // Auto generate hobe

                apply.First_name = myform.First_name;
                apply.Last_name  = myform.Last_name;
                apply.Address    = myform.Address;
                apply.Phone      = myform.Phone;
                apply.Email      = myform.Email;
                apply.Gender     = myform.Gender;

                apply.DateOfBirth = myform.Date + "-" + myform.Month + "-" + myform.BirthYear;

                apply.Marrage_status = myform.Marrage_status;
                apply.Last_degree    = myform.Last_degree;
                apply.Year           = myform.Year;
                apply.Subject        = myform.Subject;
                apply.Post           = myform.Post;
                apply.About          = myform.About;

                Data.Job_Application.Add(apply);

                Data.SaveChanges();

                //ModelState.Clear();



                try
                {
                    System.Random rand1   = new System.Random((int)System.DateTime.Now.Ticks);
                    int           random1 = rand1.Next(1, 100000000);

                    string       Path = @"D:\Repositories\HatBazar\Email_Document\Job_Application\" + random1 + ".txt";
                    StreamWriter sw   = new StreamWriter(Path);

                    //Write a line of text

                    sw.WriteLine(System.IO.File.ReadAllText(@"D:\Repositories\HatBazar\Email_Document\Job_Application\Document1.txt"));

                    sw.WriteLine("Application ID :" + apply.Application_id);
                    sw.WriteLine("First Name :" + apply.First_name);
                    sw.WriteLine("Last Name :" + apply.Last_name);
                    sw.WriteLine("Address :" + apply.Address);
                    sw.WriteLine("Phone Number :" + apply.Phone);
                    sw.WriteLine("Email :" + apply.Email);
                    sw.WriteLine("Gender :" + apply.Gender);
                    sw.WriteLine("Date of Birth :" + apply.DateOfBirth);
                    sw.WriteLine("Maritarial Status :" + apply.Marrage_status);
                    sw.WriteLine("Latest Degree :" + apply.Last_degree);
                    sw.WriteLine("Year of Passing :" + apply.Year);
                    sw.WriteLine("Subject :" + apply.Subject);
                    sw.WriteLine("Post :" + apply.Post);
                    sw.WriteLine("Resume  :" + apply.About);
                    //sw.WriteLine("all Togather :" + apply);

                    sw.WriteLine(System.IO.File.ReadAllText(@"D:\Repositories\HatBazar\Email_Document\Job_Application\Document2.txt"));
                    sw.Close();
                    try
                    {
                        //Email_ServiceController Email = new Email_ServiceController();
                        IEmail_Service      Email = new Email_ServiceClass();
                        Email_Service_Model obj   = new Email_Service_Model();

                        obj.ToEmail      = apply.Email;
                        obj.EmailSubject = "Hat Bazar";
                        obj.EMailBody    = System.IO.File.ReadAllText(Path);

                        return(Email.SendEmail(obj));
                    }
                    catch (Exception)
                    {
                        return("Problem while sending email, Please check details.");
                    }
                }

                catch
                {
                    return("Path Missing .");
                }
            }
            catch
            {
                return("Path Missing to save Email.");
            }
        }
예제 #7
0
        public string Complain(Complain complain)
        {
            Customer_Complain CC = new Customer_Complain();

            try
            {
                Customer_Information C = Data.Customer_Information.First(x => x.User_id == complain.User_Name);

                CC.Customer_ID = C.Customer_id;
                CC.DateTime    = DateTime.Now;
                CC.Massage     = complain.Message;

                Data.Customer_Complain.Add(CC);

                Data.SaveChanges();

                //ModelState.Clear();
                //TempData["Message"] = "Complain Submitted.";



                try
                {
                    System.Random rand   = new System.Random((int)System.DateTime.Now.Ticks);
                    int           random = rand.Next(1, 100000000);

                    string Path = @"D:\Repositories\HatBazar\Email_Document\Admin_Email\" + random + ".txt";
                    //Pass the filepath and filename to the StreamWriter Constructor

                    //StreamWriter sw = new StreamWriter(@"D:\Repositories\HatBazar\Email_Document\Admin_Email\Document.txt");
                    StreamWriter sw = new StreamWriter(Path);

                    //Write a line of text

                    sw.WriteLine(System.IO.File.ReadAllText(@"D:\Repositories\HatBazar\Email_Document\Admin_Email\Admin1.txt"));
                    sw.WriteLine(complain.Message);


                    sw.WriteLine(System.IO.File.ReadAllText(@"D:\Repositories\HatBazar\Email_Document\Admin_Email\Admin2.txt"));
                    //Write a second line of text
                    //sw.WriteLine("From the StreamWriter class");

                    //Close the file
                    sw.Close();



                    try
                    {
                        //Email_ServiceController Email = new Email_ServiceController();
                        IEmail_Service      Email = new Email_ServiceClass();
                        Email_Service_Model obj   = new Email_Service_Model();

                        obj.ToEmail      = C.Email;
                        obj.EmailSubject = "Hat Bazar";
                        obj.EMailBody    = System.IO.File.ReadAllText(Path);

                        return(Email.SendEmail(obj));
                    }
                    catch (Exception)
                    {
                        return("Problem while sending email, Please check details.");
                    }
                }

                catch
                {
                    return("Path Missing to save Email.");
                }
            }

            catch
            {
                //ModelState.Clear();
                return("Invalid User Name.");
            }
        }
예제 #8
0
        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());
        }