public ResponseModel editstore([FromBody] StoreMaster storeMaster, int StoreID)
        {
            StoreCaller   newStore         = new StoreCaller();
            ResponseModel objResponseModel = new ResponseModel();
            int           statusCode       = 0;
            string        statusMessage    = "";

            try
            {
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token));
                int result = newStore.EditStore(new StoreService(Cache, Db), storeMaster, StoreID, authenticate.TenantId, authenticate.UserMasterID);
                statusCode =
                    result == 0 ?
                    (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success;
                statusMessage               = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode);
                objResponseModel.Status     = true;
                objResponseModel.StatusCode = statusCode;
                objResponseModel.Message    = statusMessage;
            }
            catch (Exception)
            {
                throw;
            }
            return(objResponseModel);
        }
Example #2
0
        /// <summary>
        /// Create Store
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public int CreateStore(StoreMaster storeMaster, int TenantID, int UserID)
        {
            // MySqlCommand cmd = new MySqlCommand();
            int storeId = 0;

            try
            {
                conn = Db.Connection;
                MySqlCommand cmd = new MySqlCommand("SP_InsertStore", conn);
                cmd.Connection = conn;
                //cmd.Parameters.AddWithValue("@Brand_ID", storeMaster.BrandID);
                cmd.Parameters.AddWithValue("@Store_Code", storeMaster.StoreCode);
                cmd.Parameters.AddWithValue("@Store_Name", storeMaster.StoreName);
                cmd.Parameters.AddWithValue("@State_ID", storeMaster.StateID);
                cmd.Parameters.AddWithValue("@City_ID", storeMaster.CityID);
                cmd.Parameters.AddWithValue("@Pincode_ID", storeMaster.Pincode);
                cmd.Parameters.AddWithValue("@Store_Address", storeMaster.Address);
                cmd.Parameters.AddWithValue("@Region_ID", storeMaster.RegionID);
                cmd.Parameters.AddWithValue("@Zone_ID", storeMaster.ZoneID);
                cmd.Parameters.AddWithValue("@StoreType_ID", storeMaster.StoreTypeID);
                cmd.Parameters.AddWithValue("@StoreEmail_ID", storeMaster.StoreEmailID);
                cmd.Parameters.AddWithValue("@StorePhone_No", storeMaster.StorePhoneNo);
                cmd.Parameters.AddWithValue("@Is_Active", storeMaster.IsActive);
                cmd.Parameters.AddWithValue("@Tenant_ID", TenantID);
                cmd.Parameters.AddWithValue("@User_ID", UserID);
                cmd.Parameters.AddWithValue("@BrandIDs", storeMaster.BrandIDs);
                cmd.CommandType = CommandType.StoredProcedure;
                storeId         = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
            }

            return(storeId);
        }
Example #3
0
        private StoreMaster masterStore(int idStore)
        {
            Store storeDb = _context.Store.Where(c => c.Id == idStore).First();
            StoreMaster store = new StoreMaster();
            store.Id = idStore;
            store.Code = storeDb.Code;
            store.Name = storeDb.Name;
            store.Address = storeDb.Name;
            store.Address2 = storeDb.Address2;
            store.Address3 = storeDb.Address3;
            store.Address4 = storeDb.Address4;
            store.City = storeDb.City;
            store.Location = storeDb.Location;
            store.Regional = storeDb.Regional;
            store.StoreTypeId = storeDb.StoreTypeId;
            store.WarehouseId = storeDb.WarehouseId;
            try
            {
                store.CustomerIdStore = _context.Customer.Where(c => c.StoreId == idStore).First().CustId;

            }
            catch
            {
                //  store.CustomerIdStore = _context.Customer.Where(c => c.StoreId == 962).First().CustId;

            }

            return store;
        }
Example #4
0
        public async Task <IActionResult> EditStore(int id, [Bind("Id,ImporterName,DealerName,StoreGroupName,StoreCode,Type,StoreName,StoreAddress1,StoreAddress2,StorePhone,StoreContact,Zone,Area,Region,PostTown,StorePostcode,IsDeleted,CreatedBy,ModifiedBy")] StoreMaster storeMaster)
        {
            if (id != storeMaster.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var user = _userManager.GetUserId(User);
                    //var userName = _context.Users.Where(x => x.Id == user).Select(x => x.FirstName + " " + x.LastName).FirstOrDefault();
                    var userName = _context.Users.Where(x => x.Id == user).Select(x => x.Id).FirstOrDefault();
                    storeMaster.ModifiedBy = userName;
                    _context.Update(storeMaster);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (StoreMasterExists(storeMaster.Id))
                    {
                        throw;
                    }
                    else
                    {
                        return(NotFound());
                    }
                }
                return(RedirectToAction(nameof(StoreList)));
            }
            return(View(storeMaster));
        }
Example #5
0
 public StoreMaster Getstore(int Id)
 {
     using (trymvc1DataContext context = new trymvc1DataContext())
     {
         StoreMaster storemaster = context.StoreMasters.Where(x => x.id == Id).FirstOrDefault();
         return(storemaster);
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            StoreMaster stores = db.StoreMasters.Find(id);

            db.StoreMasters.Remove(stores);
            db.SaveChanges();
            return(RedirectToAction("StoreList"));
        }
Example #7
0
        /// <summary>
        /// get StoreDetail By Storecode OR Pincode
        /// </summary>
        /// <param name="searchText"></param>
        /// <param name="tenantID"></param>
        public List <StoreMaster> getStoreDetailByStorecodenPincode(string searchText, int tenantID)
        {
            List <StoreMaster> storeMaster = new List <StoreMaster>();
            MySqlCommand       cmd         = new MySqlCommand();
            DataSet            ds          = new DataSet();

            try
            {
                conn.Open();
                cmd.Connection = conn;
                MySqlCommand cmd1 = new MySqlCommand("SP_getStoreSDetialwithStorenamenPincode", conn);
                cmd1.Parameters.AddWithValue("@searchText", searchText);
                cmd1.Parameters.AddWithValue("@Tenant_Id", tenantID);
                cmd1.CommandType = CommandType.StoredProcedure;
                MySqlDataAdapter da = new MySqlDataAdapter(cmd1);
                da.SelectCommand = cmd1;
                da.Fill(ds);
                if (ds != null && ds.Tables[0] != null)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            StoreMaster store = new StoreMaster();
                            store.StoreCode    = ds.Tables[0].Rows[i]["StoreCode"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["StoreCode"]);
                            store.StoreName    = ds.Tables[0].Rows[i]["StoreName"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["StoreName"]);
                            store.Pincode      = ds.Tables[0].Rows[i]["PincodeID"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["PincodeID"]);
                            store.StoreEmailID = ds.Tables[0].Rows[i]["StoreEmailID"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["StoreEmailID"]);
                            store.Address      = ds.Tables[0].Rows[i]["Address"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["Address"]);
                            store.StoreID      = Convert.ToInt32(ds.Tables[0].Rows[i]["StoreID"]);
                            //store.StoreVisitDate= ds.Tables[0].Rows[i]["StoreVisitDate"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["StoreVisitDate"]);
                            //store.Purpose= ds.Tables[0].Rows[i]["Purpose"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i]["Purpose"]);
                            storeMaster.Add(store);
                        }
                    }
                    else
                    {
                        storeMaster = GetStoreDetaisFromAPI(searchText);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                if (ds != null)
                {
                    ds.Dispose();
                }
            }
            return(storeMaster);
        }
Example #8
0
        StoreMaster IStoreMaster.Getstore(int Id)
        {
            StoreMaster storemaster = new StoreMaster()
            {
                id = 1, storename = "sf"
            };

            return(storemaster);
            //throw new NotImplementedException();
        }
Example #9
0
        public IHttpActionResult Update(StoreMaster storeMaster)
        {
            var isupdate = _storeMasterRepository.Update(storeMaster);

            if (isupdate == true)
            {
                return(Ok(isupdate));
            }
            return(BadRequest());
        }
Example #10
0
        /// <summary>
        /// Get list of the Stores details from LPASS API
        /// </summary>
        /// <param name="searchText"></param>
        /// <returns></returns>
        public List <StoreMaster> GetStoreDetaisFromAPI(string searchText)
        {
            List <StoreMaster>        storeMaster     = new List <StoreMaster>();
            CustomStoreSearch         objStore        = new CustomStoreSearch();
            List <CustomStoreDetails> objStoreDetails = new List <CustomStoreDetails>();

            try
            {
                objStore.programCode     = "bata";
                objStore.storeAddressPin = searchText;

                objStore.securityToken = apisecurityToken;
                objStore.userID        = 3;
                objStore.appID         = 7;

                string apiReq = JsonConvert.SerializeObject(objStore);
                apiResponse = CommonService.SendApiRequest(apiURL + "StoreDetails", apiReq);

                if (!string.IsNullOrEmpty(apiResponse))
                {
                    ApiResponse = JsonConvert.DeserializeObject <CustomResponse>(apiResponse);

                    if (ApiResponse != null)
                    {
                        objStoreDetails = JsonConvert.DeserializeObject <List <CustomStoreDetails> >(Convert.ToString((ApiResponse.Responce)));

                        if (objStoreDetails.Count > 0)
                        {
                            for (int k = 0; k < objStoreDetails.Count; k++)
                            {
                                StoreMaster store = new StoreMaster();
                                store.StoreCode    = objStoreDetails[k].StoreCode;
                                store.StoreName    = objStoreDetails[k].StoreCode;// no store name provided in the api response hence mapped storecode mapped as per req
                                store.Pincode      = objStoreDetails[k].StorePinCode;
                                store.StoreEmailID = objStoreDetails[k].StoreEmailId;
                                store.Address      = objStoreDetails[k].StoreAddress;
                                store.StoreID      = 0;
                                store.LpassStoreID = objStoreDetails[k].StoreId;


                                storeMaster.Add(store);
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(storeMaster);
        }
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StoreMaster stores = db.StoreMasters.Find(id);

            if (stores == null)
            {
                return(HttpNotFound());
            }
            return(View(stores));
        }
Example #12
0
        /// <summary>
        /// Get list of Stores
        /// </summary>
        /// <param name="TicketId">Id of the Ticket</param>
        /// <returns></returns>
        public List <StoreMaster> getSelectedStoreByTicketId(int TicketId)
        {
            List <StoreMaster> storeMaster = new List <StoreMaster>();
            DataSet            ds          = new DataSet();
            string             GMT         = " GMT+0530 (" + TimeZoneInfo.Local.StandardName + ")";

            try
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("SP_GetSelectedStoresByTicketID", conn);
                cmd.Connection = conn;
                cmd.Parameters.AddWithValue("@Ticket_ID", TicketId);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlDataAdapter da = new MySqlDataAdapter(cmd);
                da.SelectCommand = cmd;
                da.Fill(ds);
                if (ds != null && ds.Tables[0] != null)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        StoreMaster store = new StoreMaster();
                        store.StoreCode      = ds.Tables[0].Rows[i]["StoreCode"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["StoreCode"]);
                        store.StoreName      = ds.Tables[0].Rows[i]["StoreName"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["StoreName"]);
                        store.Pincode        = ds.Tables[0].Rows[i]["Pincode"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["Pincode"]);
                        store.StoreEmailID   = ds.Tables[0].Rows[i]["StoreEmailID"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["StoreEmailID"]);
                        store.Address        = ds.Tables[0].Rows[i]["Address"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["Address"]);
                        store.StoreID        = Convert.ToInt32(ds.Tables[0].Rows[i]["StoreID"]);
                        store.StoreVisitDate = ds.Tables[0].Rows[i]["StoreVisitDate"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["StoreVisitDate"]) + GMT;
                        store.Purpose        = ds.Tables[0].Rows[i]["Purpose"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i]["Purpose"]);
                        storeMaster.Add(store);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                if (ds != null)
                {
                    ds.Dispose();
                }
            }
            return(storeMaster);
        }
Example #13
0
        /// <summary>
        /// Search Store
        /// <param name="StateID"></param>
        /// <param name="PinCode"></param>
        /// <param name="Area"></param>
        ///  <param name="IsCountry"></param>
        /// </summary>
        public List <StoreMaster> SearchStore(int StateID, int PinCode, string Area, bool IsCountry)
        {
            List <StoreMaster> storeMaster = new List <StoreMaster>();
            DataSet            ds          = new DataSet();

            try
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("SP_SearchStore", conn);
                cmd.Connection = conn;
                cmd.Parameters.AddWithValue("@State_ID", StateID);
                cmd.Parameters.AddWithValue("@Pin_Code", PinCode);
                cmd.Parameters.AddWithValue("@Store_Area", Area);
                cmd.Parameters.AddWithValue("@Is_Country", IsCountry);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlDataAdapter da = new MySqlDataAdapter(cmd);
                da.SelectCommand = cmd;
                da.Fill(ds);
                if (ds != null && ds.Tables[0] != null)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        StoreMaster store = new StoreMaster();
                        store.StoreID      = Convert.ToInt32(ds.Tables[0].Rows[i]["StoreID"]);
                        store.StoreName    = Convert.ToString(ds.Tables[0].Rows[i]["StoreName"]);
                        store.StoreCode    = Convert.ToString(ds.Tables[0].Rows[i]["StoreCode"]);
                        store.StorePhoneNo = Convert.ToString(ds.Tables[0].Rows[i]["StoreCode"]);
                        //store.CreatedDate = Convert.ToDateTime(ds.Tables[0].Rows[i][""]);
                        storeMaster.Add(store);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                if (ds != null)
                {
                    ds.Dispose();
                }
            }
            return(storeMaster);
        }
Example #14
0
        public async Task <IActionResult> CreateStore([Bind("Id,ImporterName,DealerName,StoreGroupName,StoreCode,Type,StoreName,StoreAddress1,StoreAddress2,StorePhone,StoreContact,Zone,Area,Region,PostTown,StorePostcode,IsDeleted,CreatedBy,ModifiedBy")] StoreMaster storeMaster)
        {
            if (ModelState.IsValid)
            {
                var user = _userManager.GetUserId(User);
                //   var userName = _context.Users.Where(x => x.Id == user).Select(x=>x.FirstName+" "+x.LastName).FirstOrDefault() ;
                var userName = _context.Users.Where(x => x.Id == user).Select(x => x.Id).FirstOrDefault();
                storeMaster.CreatedBy = userName;
                _context.Add(storeMaster);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(StoreList)));
            }
            return(View(storeMaster));
        }
        public ActionResult Edit(int?id)
        {
            ViewBag.Status = new SelectList(db.StatusMasters, "CustomerId,RecordId", "StatusName");

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StoreMaster stores = db.StoreMasters.Find(id);

            if (stores == null)
            {
                return(HttpNotFound());
            }
            return(View(stores));
        }
Example #16
0
        /// <summary>
        /// Get list of the Stores
        /// </summary>
        /// <param name="searchText"></param>
        ///  <param name="tenantID"></param>
        /// <returns></returns>
        public List <StoreMaster> getStores(string searchText, int tenantID)
        {
            List <StoreMaster> storeMaster = new List <StoreMaster>();
            MySqlCommand       cmd         = new MySqlCommand();
            DataSet            ds          = new DataSet();

            try
            {
                conn.Open();
                cmd.Connection = conn;
                MySqlCommand cmd1 = new MySqlCommand("SP_getStores", conn);
                cmd1.Parameters.AddWithValue("@Tenant_Id", tenantID);
                cmd1.Parameters.AddWithValue("@searchText", searchText);
                cmd1.CommandType = CommandType.StoredProcedure;
                MySqlDataAdapter da = new MySqlDataAdapter(cmd1);
                da.SelectCommand = cmd1;
                da.Fill(ds);
                if (ds != null && ds.Tables[0] != null)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        StoreMaster store = new StoreMaster();
                        store.StoreID   = Convert.ToInt32(ds.Tables[0].Rows[i]["StoreID"]);
                        store.StoreName = Convert.ToString(ds.Tables[0].Rows[i]["StoreName"]);
                        store.Address   = Convert.ToString(ds.Tables[0].Rows[i]["Address"]);

                        storeMaster.Add(store);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                if (ds != null)
                {
                    ds.Dispose();
                }
            }
            return(storeMaster);
        }
        public List <StoreMaster> getStore(String storeCode)
        {
            //1 city, 2 regional
            List <StoreMaster> listRetails = new List <StoreMaster>();
            List <Store>       stores      = new List <Store>();


            String customerId = "";

            stores = _context.Store.Where(c => c.Code != "ACF" || c.Code != "CAM" ||
                                          c.Code != "KAT" || c.Code != "KAU" || c.Code != "LAC" || c.Code != "NBR" ||
                                          c.Code != "NBS" || c.Code != "NBT" || c.Code != "300" ||
                                          c.Code != "310").ToList();
            foreach (Store p in stores)
            {
                try
                {
                    customerId = _context.Customer.Where(c => c.StoreId == p.Id).First().CustId;
                }
                catch (Exception ex)
                {
                    customerId = "Non";
                }

                StoreMaster article = new StoreMaster
                {
                    Id              = p.Id,
                    Code            = p.Code,
                    Name            = p.Name,
                    City            = p.City,
                    Regional        = p.Regional,
                    Address         = p.Address,
                    CustomerIdStore = customerId
                };

                if (article.CustomerIdStore.Equals("Non"))
                {
                }
                else
                {
                    listRetails.Add(article);
                }
            }

            return(listRetails);
        }
Example #18
0
        /// <summary>
        /// Edit Store
        /// </summary>
        /// <param name="storeMaster"></param>
        /// <param name="TenantID"></param>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public int EditStore(StoreMaster storeMaster, int TenantID, int UserID)
        {
            int Success = 0;

            try
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("SP_UpdateStore", conn);
                cmd.Connection = conn;
                //cmd.Parameters.AddWithValue("@Brand_ID", storeMaster.BrandID);
                cmd.Parameters.AddWithValue("@Store_Code", storeMaster.StoreCode);
                cmd.Parameters.AddWithValue("@Store_Name", storeMaster.StoreName);
                cmd.Parameters.AddWithValue("@State_ID", storeMaster.StateID);
                cmd.Parameters.AddWithValue("@City_ID", storeMaster.CityID);
                cmd.Parameters.AddWithValue("@Pincode_ID", storeMaster.PincodeID);
                cmd.Parameters.AddWithValue("@Store_Address", storeMaster.Address);
                cmd.Parameters.AddWithValue("@Region_ID", storeMaster.RegionID);
                cmd.Parameters.AddWithValue("@Zone_ID", storeMaster.ZoneID);
                cmd.Parameters.AddWithValue("@StoreType_ID", storeMaster.StoreTypeID);
                cmd.Parameters.AddWithValue("@StoreEmail_ID", storeMaster.StoreEmailID);
                cmd.Parameters.AddWithValue("@StorePhone_No", storeMaster.StorePhoneNo);
                cmd.Parameters.AddWithValue("@Is_Active", storeMaster.IsActive);
                cmd.Parameters.AddWithValue("@Tenant_ID", TenantID);
                cmd.Parameters.AddWithValue("@User_ID", UserID);
                cmd.Parameters.AddWithValue("@Store_ID", storeMaster.StoreID);
                cmd.Parameters.AddWithValue("@BrandIDs", storeMaster.BrandIDs);
                cmd.CommandType = CommandType.StoredProcedure;
                Success         = Convert.ToInt32(cmd.ExecuteNonQuery());
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }


            return(Success);
        }
        public ActionResult Create([Bind(Include = "CustomerId,StoreNumber,StoreName,StoreStatus,StoreDesc,StoreImgName")] StoreMaster storeMaster, HttpPostedFileBase StoreImgName)
        {
            StoreMaster s = new StoreMaster();

            ViewBag.Status = new SelectList(db.StatusMasters, "RecordId", "StatusName");
            if (StoreImgName != null)
            {
                string path = Server.MapPath("~/Uploads/");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                System.Drawing.Image img = System.Drawing.Image.FromStream(StoreImgName.InputStream);
                int     height           = img.Height;
                int     width            = img.Width;
                decimal size             = Math.Round(((decimal)StoreImgName.ContentLength / (decimal)1024), 2);

                if (width == 300 || height == 250)
                {
                    s.EmployeeID   = Convert.ToInt32(@Session["employeecode"]);
                    s.CreatedDate  = DateTime.Now;
                    s.StoreName    = storeMaster.StoreName;
                    s.StoreNumber  = storeMaster.StoreNumber;
                    s.StoreStatus  = storeMaster.StoreStatus;
                    s.StoreImgName = (storeMaster.StoreName + "_" + Path.GetFileName(StoreImgName.FileName));
                    s.StoreDesc    = storeMaster.StoreDesc;
                    db.StoreMasters.Add(s);
                    db.SaveChanges();
                    StoreImgName.SaveAs(path + (storeMaster.StoreName + "_" + Path.GetFileName(StoreImgName.FileName)));
                    return(RedirectToAction("Create"));
                }
                else
                {
                    ViewBag.ImgMessage = string.Format("Please Select Image With resolution of 300px X 250px .\\nCurrent resolution is Width: {0}px and Heigth: {1}px", width.ToString(), height.ToString());
                    return(View());
                }
            }
            else
            {
                ViewBag.ImgMessage = string.Format("Please select image");
                return(View());
            }
        }
        public ActionResult Edit([Bind(Include = "CustomerId,RecordId,StoreNumber,StoreName,StoreStatus,StoreDesc")] StoreMaster store)
        {
            StoreMaster s = (from c in db.StoreMasters
                             where c.RecordId == store.RecordId
                             select c).FirstOrDefault();

            ViewBag.Status = new SelectList(db.StatusMasters, "RecordId", "StatusName");
            var file = Request.Files["ImageUpload"];

            if (file != null && file.ContentLength > 0)
            {
                string path = Server.MapPath("~/Uploads/");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                System.Drawing.Image img = System.Drawing.Image.FromStream(file.InputStream);
                int     height           = img.Height;
                int     width            = img.Width;
                decimal size             = Math.Round(((decimal)file.ContentLength / (decimal)1024), 2);
                if (width == 300 || height == 250)
                {
                    file.SaveAs(path + (store.StoreName + "_" + Path.GetFileName(file.FileName)));
                    s.StoreImgName = store.StoreName + "_" + Path.GetFileName(file.FileName);
                }
                else
                {
                    ViewBag.ImgMessage = string.Format("Please Select Image With resolution of 300px X 250px .\\nCurrent resolution is Width: {0}px and Heigth: {1}px", width.ToString(), height.ToString());
                    return(RedirectToAction("Edit/1"));;
                }
            }
            s.EmployeeID  = Convert.ToInt32(@Session["employeecode"]);
            s.StoreName   = store.StoreName;
            s.StoreNumber = store.StoreNumber;
            s.StoreStatus = store.StoreStatus;
            s.StoreDesc   = store.StoreDesc;
            s.UpdatedDate = DateTime.Now;
            db.SaveChanges();
            return(RedirectToAction("StoreList"));
        }
Example #21
0
        public bool Update(StoreMaster storeMaster)
        {
            bool returnvalue = false;

            DynamicParameters param = new DynamicParameters();

            param.Add("@Id", storeMaster.Id);
            param.Add("@IsActive", 1);
            param.Add("@CreatedBy", 1);
            param.Add("@CreatedDate", DateTime.UtcNow);
            param.Add("@ModifiedBy", 1);
            param.Add("@ModifiedDate", DateTime.UtcNow);
            param.Add("@Name", storeMaster.Name);
            _db.Open();
            var val = _db.Execute("USP_UpdateStoreMaster", param, commandType: CommandType.StoredProcedure);

            if (val > 0)
            {
                returnvalue = true;
            }

            _db.Close();
            return(returnvalue);
        }
Example #22
0
 bool IStoreMaster.UpdateDocument(StoreMaster storemaster)
 {
     throw new NotImplementedException();
 }
Example #23
0
 public bool SaveDocument(StoreMaster storemaster)
 {
     throw new NotImplementedException();
 }
Example #24
0
 public int EditStore(IStore store, StoreMaster storeMaster, int TenantID, int UserID)
 {
     _storeRepository = store;
     return(_storeRepository.EditStore(storeMaster, TenantID, UserID));
 }
Example #25
0
        // GET: Store
        public ActionResult Index()
        {
            StoreMaster storemaster = _IStoreMaster.Getstore(1);

            return(View(storemaster));
        }