Exemple #1
0
        public string deleteMenu(int Id)
        {
            string Message = "";
            NoHungKitchenWebEntities Db = new NoHungKitchenWebEntities();
            var deleteRecord            = Db.tblMenus.Where(p => p.MenuId == Id).FirstOrDefault();

            if (deleteRecord != null)
            {
                Db.tblMenus.Remove(deleteRecord);
            }
            ;
            Db.SaveChanges();
            Message = "Record Deleted Successfully";
            return(Message);
        }
Exemple #2
0
        public string SaveMenu(HttpPostedFileBase fb, MenuModel model)
        {
            string Message = "";
            NoHungKitchenWebEntities db = new NoHungKitchenWebEntities();
            string filePath             = "";
            string fileName             = "";
            string sysFileName          = "";


            if (fb != null && fb.ContentLength > 0)
            {
                filePath = HttpContext.Current.Server.MapPath("~/Content/Images/MenuPhoto/");
                DirectoryInfo di = new DirectoryInfo(filePath);
                if (!di.Exists)
                {
                    di.Create();
                }
                fileName    = fb.FileName;
                sysFileName = DateTime.Now.ToFileTime().ToString() + Path.GetExtension(fb.FileName);
                fb.SaveAs(filePath + "//" + sysFileName);
                if (!string.IsNullOrWhiteSpace(fb.FileName))
                {
                    string afileName = HttpContext.Current.Server.MapPath("~/Content/Images/MenuPhoto/") + "/" + sysFileName;
                }
            }
            var savemenu = new tblMenu()
            {
                KitchenId   = model.KitchenId,
                MenuTitle   = model.MenuTitle,
                Category    = model.Category,
                Qty         = model.Qty,
                SalePrice   = model.SalePrice,
                Status      = model.Status,
                Description = model.Description,
                MenuPhoto   = sysFileName,
            };

            db.tblMenus.Add(savemenu);
            db.SaveChanges();
            return(Message);
        }
        public string SaveRegistration(HttpPostedFileBase fb, HttpPostedFileBase fb1, HttpPostedFileBase fb2, RegistrationModel model)
        {
            string Message = "";
            NoHungKitchenWebEntities db = new NoHungKitchenWebEntities();
            string filePath             = "";
            string fileName             = "";
            string sysFileName          = "";
            string fileName1            = "";
            string sysFileName1         = "";
            string fileName2            = "";
            string sysFileName2         = "";

            filePath = HttpContext.Current.Server.MapPath("~/Content/images/Kitchen/");
            DirectoryInfo di = new DirectoryInfo(filePath);

            if (!di.Exists)
            {
                di.Create();
            }
            if (fb != null && fb.ContentLength > 0)
            {
                fileName    = fb.FileName;
                sysFileName = DateTime.Now.ToFileTime().ToString() + Path.GetExtension(fb.FileName);
                fb.SaveAs(filePath + "//" + sysFileName);
                if (!string.IsNullOrWhiteSpace(fb.FileName))
                {
                    string afileName = HttpContext.Current.Server.MapPath("~/Content/images/Kitchen/") + "/" + sysFileName;
                    //string afileName = HttpContext.Current.Server.MapPath("~/Content/documents/Kitchendocuments/") + "/" + sysFileName;
                }
            }
            if (fb1 != null && fb1.ContentLength > 0)
            {
                fileName1    = fb1.FileName;
                sysFileName1 = DateTime.Now.ToFileTime().ToString() + Path.GetExtension(fb1.FileName);
                fb1.SaveAs(filePath + "//" + sysFileName1);
                if (!string.IsNullOrWhiteSpace(fb1.FileName))
                {
                    string afileName = HttpContext.Current.Server.MapPath("~/Content/Images/Kitchen/") + "/" + sysFileName1;
                }
            }
            if (fb2 != null && fb1.ContentLength > 0)
            {
                fileName2    = fb1.FileName;
                sysFileName2 = DateTime.Now.ToFileTime().ToString() + Path.GetExtension(fb2.FileName);
                fb2.SaveAs(filePath + "//" + sysFileName2);
                if (!string.IsNullOrWhiteSpace(fb2.FileName))
                {
                    string afileName = HttpContext.Current.Server.MapPath("~/Content/Images/MenuPhoto/") + "/" + sysFileName2;
                }
            }
            var getKitchen = db.tblKitchenMasters.Where(p => p.KitchenName == model.KitchenName).FirstOrDefault();

            if (getKitchen == null)
            {
                var saveregistration = new tblKitchenMaster()
                {
                    KitchenName         = model.KitchenName,
                    Mobile              = model.Mobile,
                    Email               = model.Email,
                    State               = model.State,
                    City                = model.City,
                    Pin                 = model.Pin,
                    Address             = model.Address,
                    OwnerName           = model.OwnerName,
                    Password            = model.Password,
                    UploadDocuments     = sysFileName1,
                    KitchenImage        = sysFileName,
                    MenuImage           = sysFileName2,
                    ContactPerson       = model.ContactPerson,
                    ContactPersonRole   = model.ContactPersonRole,
                    KitchenContactNo    = model.KitchenContactNo,
                    FSSAILicenseNo      = model.FSSAILicenseNo,
                    ExpiryDateOfLicense = model.ExpiryDateOfLicense,
                    PanCardNo           = model.PanCardNo,
                    GSTRegNo            = model.GSTRegNo,
                };
                db.tblKitchenMasters.Add(saveregistration);
                db.SaveChanges();
                string mobile    = model.Mobile;
                string sAPIKey   = "fYMsEmpZQUewatTPf0TktQ";
                string sNumber   = mobile;
                string sMessage  = "Hi, " + model.OwnerName + "- NoHung KitchenId: " + saveregistration.KitchenId + " & Pass: "******"BSCAKE";
                string sChannel  = "trans";
                string sRoute    = "8";
                // string sURL = "http://mysms.msg24.in/api/mt/SendSMS?APIKEY=" + sAPIKey + "&senderid=" + sSenderId + "&channel=" + sChannel + "&DCS=0&flashsms=0&number=" + sNumber + "&text=" + sMessage + "&route=" + sRoute + "";
                string sURL = "http://mysms.msg24.in/api/mt/SendSMS?APIKEY=" + sAPIKey + "&senderid=" + sSenderId + "&channel=" + sChannel + "&DCS=0&flashsms=0&number=" + sNumber + "&text=" + sMessage + "&route=" + sRoute + "";

                string sResponse = GetResponse(sURL);
                //Response.Write(sResponse);
                Message = model.KitchenName + " Kitchen added Successfully with KitchenId: " + saveregistration.KitchenId;
            }
            else
            {
                Message = model.KitchenName + " Kitchen Name already exist.";
            }
            return(Message);
        }