public BaseModel GetProductMasters(ProductMasterModel model) { BaseModel Response = new BaseModel(); Response = objProductMasterBAL.GetProductMasters(model); return(Response); }
public async Task <ActionResult> GetProductById(string id) { //string strint = id.Trim().ToString(); var intid = Convert.ToInt32(id); ProductMasterModel pro = new ProductMasterModel(); ProductMasterModelSingleRootObject obj = new ProductMasterModelSingleRootObject(); string url = GetUrl(2); url = url + "Product/GetProductById?id=" + Convert.ToInt32(intid) + ""; using (HttpClient client = new HttpClient()) { HttpResponseMessage responseMessage = await client.GetAsync(url); if (responseMessage.IsSuccessStatusCode) { var response = responseMessage.Content.ReadAsStringAsync().Result; var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }; obj = JsonConvert.DeserializeObject <ProductMasterModelSingleRootObject>(response, settings); pro = obj.data; TempData["item"] = pro; } } return(RedirectToAction("Index")); }
public static IList <ProductMasterModel> GetProductMasterList(int ProcessId, int selectionType, string SearchBy, string SearchString, Guid CompanyId, int ItemsPerPage, int RequestPage, int CurrentPageNo) { ArrayList paramlist = new ArrayList(); string resultString; IList <ProductMasterModel> objproductMasterModel = null; ProductMasterModel obj = new ProductMasterModel(); string prosId = ""; obj.SearchString = SearchString; obj.RequestType = selectionType; obj.ProcessId = prosId; obj.CompanyId = CompanyId; obj.ItemsPerPage = ItemsPerPage; obj.RequestPageNo = RequestPage; obj.CurrentPageNo = CurrentPageNo; paramlist.Add(obj); using (var client = new HttpClient()) { Uri baseAddres = new Uri(System.Configuration.ConfigurationManager.AppSettings["UriPath"]); client.BaseAddress = baseAddres; resultString = client.PostAsJsonAsync("api/ProductMaster/ProductMaster_List", paramlist) .Result .Content.ReadAsStringAsync().Result; } objproductMasterModel = (IList <ProductMasterModel>)Newtonsoft.Json.JsonConvert.DeserializeObject(resultString, typeof(IList <ProductMasterModel>)); return(objproductMasterModel); }
public static ProductMasterModel ProductMasterModule_InsertUpdate(ProductMasterModel objproduct) { ArrayList paramList = new ArrayList(); string resultString; ProductMasterModel objProductModule = null; ProductMasterModel obj = new ProductMasterModel(); obj.Productid = objproduct.Productid; obj.ProductName = objproduct.ProductName; obj.UOM = objproduct.UOM; obj.Color = objproduct.Color; //obj.State = objproduct.State; obj.Texture = objproduct.Texture; obj.CreatedBy = objproduct.CreatedBy; obj.CreatedDate = objproduct.CreatedDate; obj.IsDelete = objproduct.IsDelete; obj.SafeLifeInGodown = objproduct.SafeLifeInGodown; obj.ProcessId = objproduct.ProcessId; obj.BuyProductId = objproduct.BuyProductId; obj.BuyProductPacking = objproduct.BuyProductPacking; obj.CompanyId = objproduct.CompanyId; paramList.Add(obj); using (var client = new HttpClient()) { Uri baseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["UriPath"]); client.BaseAddress = baseAddress; resultString = client.PostAsJsonAsync("api/ProductMaster/ProductMaster_InsertUpdate", paramList) .Result .Content.ReadAsStringAsync().Result; } objProductModule = (ProductMasterModel)Newtonsoft.Json.JsonConvert.DeserializeObject(resultString, typeof(ProductMasterModel)); return(objProductModule); }
public DataTable SaveProductMaster(ProductMasterModel model) { DataTable dt = new DataTable(); SqlParameter[] arrproc; string spName = "SaveProductMaster"; arrproc = new SqlParameter[16]; arrproc[0] = new SqlParameter("@ProductCategoryId", model.ProductCategoryId); arrproc[1] = new SqlParameter("@ProductSubCategoryId", model.ProductSubCategoryId); arrproc[2] = new SqlParameter("@ProductCode", model.ProductCode); arrproc[3] = new SqlParameter("@ProductName", model.ProductName); arrproc[4] = new SqlParameter("@ProductDescription", model.ProductDescription); arrproc[5] = new SqlParameter("@ProductCompanyId", model.ProductCompanyId); arrproc[6] = new SqlParameter("@Packing", model.Packing); arrproc[7] = new SqlParameter("@PurchaseUnitId", model.PurchaseUnitId); arrproc[8] = new SqlParameter("@SalesUnitId", model.SalesUnitId); arrproc[9] = new SqlParameter("@PuchaseTaxId", model.PuchaseTaxId); arrproc[10] = new SqlParameter("@SaleTaxId", model.SaleTaxId); arrproc[11] = new SqlParameter("@TaxAplicability", model.TaxAplicability); arrproc[12] = new SqlParameter("@HSNCode", model.HSNCode); arrproc[13] = new SqlParameter("@SACCode", model.SACCode); arrproc[14] = new SqlParameter("@IsActive", model.IsActive); arrproc[15] = new SqlParameter("@CreatedBy", model.UserId); ADOContext _dbContext = new ADOContext(); dt = _dbContext.ExecSQLProc(spName, arrproc); return(dt); }
public BaseModel GetProductMasters(ProductMasterModel model) { BaseModel objBaseModel = new BaseModel(); objBaseModel.DataResult = objProductMasterDAL.GetProductMaster(model).ToList <ProductMasterModel>(); return(objBaseModel); }
public ActionResult ProductInser_Update(ProductMasterModel pbj) { pbj.CompanyId = Guid.Parse("f2d725f7-1d94-4cf9-95e5-cf409dc72c1b".ToString()); string selectedValue = string.Join(",", pbj.ProcessIds); pbj.ProcessId = selectedValue; pbj = CommonCalls.ProductMasterModule_InsertUpdate(pbj); if (pbj.Productid == 0) { ViewBag.ButtonCaption = "Add "; } else { ViewBag.ButtonCaption = "Update "; } if (pbj.ReturnCode == 0) { ViewBag.PopupMessage = pbj.ReturnMessage; return(RedirectToAction("Index", "ProductMaster")); } else if (pbj.ReturnCode == 101) { ViewBag.PopupMessage = pbj.ReturnMessage; return(RedirectToAction("Index", "ProductMaster")); } return(View("ProductInser_Update", pbj)); }
public BaseModel SaveProductMaster(ProductMasterModel model) { BaseModel Response = new BaseModel(); objProductMasterBAL.SaveProductMaster(model); Response.RequestEntityId = model.RequestEntityId; Response.RequestMessage = model.RequestMessage; return(Response); }
public IList <ProductMasterModel> Product_List(ArrayList paramList) { ProductMasterModel apiObject = new ProductMasterModel(); string strResult = ""; IList <ProductMasterModel> apiObjectList = null; apiObject = Newtonsoft.Json.JsonConvert.DeserializeObject <ProductMasterModel>(paramList[0].ToString()); apiObjectList = fnProductMaster_List(apiObject, ref strResult); return(apiObjectList); }
public void SaveProductMaster(ProductMasterModel model) { DataTable dt = objProductMasterDAL.SaveProductMaster(model); if (dt != null) { model.RequestEntityId = EncodeDecodeQueryString.EncodeQueryString(dt.Rows[0]["ProductMasterId"].ToString()); model.RequestMessage = dt.Rows[0]["Message"].ToString(); } }
public ActionResult ProductInser_Update(int?ProductId) { ProductMasterModel objProductMaster = new ProductMasterModel(); string SearchBy = ""; string SearchString = ""; Guid CompanyId = Guid.Parse("f2d725f7-1d94-4cf9-95e5-cf409dc72c1b"); int ItemsPerPage = 0; int RequestPage = 0; int CurrentPageNo = 0; /*................General Masster List.......................*/ IList <GeneralMasterModel> objtexture = CommonCalls.GetGeneralMasterList(0, 1, 2, SearchBy, SearchString, CompanyId, ItemsPerPage, RequestPage, CurrentPageNo); ViewBag.texture = objtexture; /*................General Masster List.......................*/ IList <GeneralMasterModel> objpacking = CommonCalls.GetGeneralMasterList(0, 1, 6, SearchBy, SearchString, CompanyId, ItemsPerPage, RequestPage, CurrentPageNo); ViewBag.Packing = objpacking; /*................General Masster List.......................*/ IList <GeneralMasterModel> objcolor = CommonCalls.GetGeneralMasterList(1, 0, 3, SearchBy, SearchString, CompanyId, ItemsPerPage, RequestPage, CurrentPageNo); ViewBag.color = objcolor; int RequestPageNo = 0; /*................General Masster List.......................*/ IList <UOMMasterModel> objUOMMaster = CommonCalls.GetUOMMasterList(0, 1, SearchBy, SearchString, CompanyId, ItemsPerPage, RequestPageNo, CurrentPageNo); ViewBag.UOm = objUOMMaster; /*................Process List..........*/ IList <ProcessMasterModel> objprocess = CommonCalls.GetProcessMasterList(1, 1, SearchBy, SearchString, CompanyId, ItemsPerPage, RequestPageNo, CurrentPageNo); ViewBag.Process = objprocess; if (ProductId == null || ProductId == 0) { ViewBag.ButtonCaption = "Add "; ViewBag.PopupMessage = ""; } else { ViewBag.ButtonCaption = "Update"; IList <ProductMasterModel> objProductMasterList = CommonCalls.GetProductMasterList(0, 1, SearchBy, SearchString, CompanyId, ItemsPerPage, RequestPage, CurrentPageNo); objProductMaster = objProductMasterList[0]; } return(View(objProductMaster)); }
public DataTable GetProductMaster(ProductMasterModel model) { DataTable dt = new DataTable(); SqlParameter[] arrproc; string spName = "GetProductMaster"; ADOContext _dbContext = new ADOContext(); arrproc = new SqlParameter[7]; arrproc[0] = new SqlParameter("@PageNumber", model.PageNumber); arrproc[1] = new SqlParameter("@RecordSize", model.RecordSize); arrproc[2] = new SqlParameter("@ProductCategoryId", model.ProductCategoryId); arrproc[3] = new SqlParameter("@ProductSubCategoryId", model.ProductSubCategoryId); arrproc[4] = new SqlParameter("@ProductCode", model.ProductCode); arrproc[5] = new SqlParameter("@ProductName", model.ProductName); arrproc[6] = new SqlParameter("@ProductCompanyId", model.ProductCompanyId); dt = _dbContext.ExecSQLProc(spName, arrproc); return(dt); }
private IList <ProductMasterModel> fnProductMaster_List(ProductMasterModel apiObject, ref string strResult) { string strReturnCode = "000"; string strReturnMsg = "UnDefined"; string crCnString = UtilityLib.GetConnectionString(); IList <ProductMasterModel> objFieldClassModelList = new List <ProductMasterModel>(); DataSet usersInfoDS = DL_ProductMaster.Product_List(crCnString, apiObject.RequestType, apiObject.SearchBy, apiObject.SearchString, apiObject.Productid, apiObject.CompanyId, apiObject.ItemsPerPage, apiObject.RequestPageNo, apiObject.CurrentPageNo); DataTable usersInfoDT = usersInfoDS.Tables[0]; if (usersInfoDT != null && usersInfoDT.Rows.Count > 0) { strReturnCode = "001"; strReturnMsg = "Success"; foreach (DataRow dr in usersInfoDT.Rows) { apiObject = new ProductMasterModel(); apiObject.Productid = UtilityLib.FormatNumber(dr["Processid"].ToString()); apiObject.ProductName = (string)dr["ProductName"]; apiObject.UOM = UtilityLib.FormatNumber(dr["UOM"].ToString()); //apiObject.State = UtilityLib.FormatString(dr["State"]); //apiObject.Texture = UtilityLib.FormatNumber(dr["Texture "].ToString()); //apiObject.Catagory = UtilityLib.FormatNumber(dr["Catagory "].ToString()); apiObject.CreatedBy = (Guid)(dr["CreatedBy"]); apiObject.CreatedDate = UtilityLib.FormatDate(dr["CreatedDate"]); apiObject.IsDelete = UtilityLib.FormatBoolean(dr["IsDelete"].ToString()); apiObject.SafeLifeInGodown = UtilityLib.FormatDate(dr["SafeLifeInGodown"]); apiObject.ProcessId = (string)(dr["ProcessId"]); apiObject.BuyProductId = UtilityLib.FormatNumber(dr["BuyProductId"].ToString()); apiObject.BuyProductPacking = UtilityLib.FormatNumber(dr["BuyProductPacking"].ToString()); apiObject.CompanyId = (Guid)(dr["CompanyId"]); objFieldClassModelList.Add(apiObject); } } else { strReturnCode = "002"; strReturnMsg = "Fail-Record Not Found"; } strResult = strReturnCode + "|" + strReturnMsg; return(objFieldClassModelList); }
public ProductMasterModel ProductMaster_InsertUpdate(ArrayList paramList) { string strResult = ""; string strReturnCode = "000"; string strReturnMsg = "UnDefined"; ProductMasterModel apiObject = new ProductMasterModel(); apiObject = Newtonsoft.Json.JsonConvert.DeserializeObject <ProductMasterModel>(paramList[0].ToString()); string crCnString = UtilityLib.GetConnectionString(); int Processinfo = DL_ProductMaster.ProductInsert(crCnString, apiObject.Productid, apiObject.ProductName, apiObject.UOM, apiObject.Color, apiObject.Texture, apiObject.CreatedBy, apiObject.ProcessId, apiObject.BuyProductId, apiObject.BuyProductPacking, apiObject.Catagory, apiObject.CompanyId); if (Processinfo == 0) { apiObject.ReturnCode = Processinfo; apiObject.ReturnMessage = "Product Added Successfully"; } else if (Processinfo == 1) { apiObject.ReturnCode = Processinfo; apiObject.ReturnMessage = "Product already exists"; } else if (Processinfo == 101) { apiObject.ReturnCode = Processinfo; apiObject.ReturnMessage = "Product updated successfully"; } else if (Processinfo == 2) { apiObject.ReturnCode = Processinfo; apiObject.ReturnMessage = "record is already updated by someone else"; } else { apiObject.ReturnCode = Processinfo; apiObject.ReturnMessage = "Fail-Record Not Inserted"; } strResult = strReturnCode + "|" + strReturnMsg; return(apiObject); }
// GET: ProductMaster public async Task <ActionResult> Index() { ViewBag.LoginID = Session["LoginID"].ToString(); ViewBag.Username = Session["Username"].ToString(); ViewBag.StoreId = Session["StoreId"].ToString(); ViewBag.Message = "Your application Daily Activity page."; //string url = GetUrl(2); //url = url + "Localities/GetAllLocalitiesWithOutPagging"; //LocalityMasterModelRootObject obj = new LocalityMasterModelRootObject(); //using (HttpClient client = new HttpClient()) //{ // HttpResponseMessage responseMessage = await client.GetAsync(url); // if (responseMessage.IsSuccessStatusCode) // { // var result = responseMessage.Content.ReadAsStringAsync().Result; // obj = JsonConvert.DeserializeObject<LocalityMasterModelRootObject>(result); // IList<SelectListItem> LSelectList = new List<SelectListItem>(); // foreach (var item in obj.data) // { // LSelectList.Add(new SelectListItem { Text = item.LocalityName, Value = item.LocalityId.ToString() }); // } // LSelectList.Insert(0, new SelectListItem() { Value = "", Text = "Select Locality" }); // //LSelectList.Insert(1, new SelectListItem() { Value = "0", Text = "All" }); // ViewBag.LocalityList = LSelectList; // } //} //string preurl = GetUrl(2); //preurl = preurl + "Store/GetAllStoreList"; //StoreMasterModelRootObject pobj = new StoreMasterModelRootObject(); ////List<ProductMasterModel> Prlist = new List<ProductMasterModel>(); //using (HttpClient prclient = new HttpClient()) //{ // HttpResponseMessage responseMessage = await prclient.GetAsync(preurl); // if (responseMessage.IsSuccessStatusCode) // { // var result = responseMessage.Content.ReadAsStringAsync().Result; // pobj = JsonConvert.DeserializeObject<StoreMasterModelRootObject>(result); // IList<SelectListItem> ProSelectList = new List<SelectListItem>(); // foreach (var item in pobj.data) // { // ProSelectList.Add(new SelectListItem { Text = item.StoreName, Value = item.StoreId.ToString() }); // } // ProSelectList.Insert(0, new SelectListItem() { Value = "", Text = "Select Store" }); // //ProSelectList.Insert(1, new SelectListItem() { Value = "0", Text = "All" }); // ViewBag.StoreList = ProSelectList; // } //} //string murl = GetUrl(2); //murl = murl + "MenuMaster/GetAllMenuList"; //MenuMasterModelRootObject mobj = new MenuMasterModelRootObject(); ////List<MenuMasterModel> mlist = new List<MenuMasterModel>(); //using (HttpClient cclient = new HttpClient()) //{ // HttpResponseMessage responseMessage = await cclient.GetAsync(murl); // if (responseMessage.IsSuccessStatusCode) // { // var result = responseMessage.Content.ReadAsStringAsync().Result; // mobj = JsonConvert.DeserializeObject<MenuMasterModelRootObject>(result); // IList<SelectListItem> mSelectList = new List<SelectListItem>(); // foreach (var item in mobj.data) // { // mSelectList.Add(new SelectListItem { Text = item.MenuName, Value = item.MenuId.ToString() }); // } // mSelectList.Insert(0, new SelectListItem() { Value = "", Text = "Select Menu" }); // // mSelectList.Insert(1, new SelectListItem() { Value = "0", Text = "All" }); // ViewBag.MenuList = mSelectList; // } //} string Clienturl = GetUrl(2); Clienturl = Clienturl + "Category/GetAllCategoryList?StoreId=" + ViewBag.StoreId + ""; CategoryMasterModelRootObject cobj = new CategoryMasterModelRootObject(); //List<CategoryMasterModel> clist = new List<CategoryMasterModel>(); using (HttpClient cclient = new HttpClient()) { HttpResponseMessage responseMessage = await cclient.GetAsync(Clienturl); if (responseMessage.IsSuccessStatusCode) { var result = responseMessage.Content.ReadAsStringAsync().Result; cobj = JsonConvert.DeserializeObject <CategoryMasterModelRootObject>(result); IList <SelectListItem> CSelectList = new List <SelectListItem>(); foreach (var item in cobj.data) { CSelectList.Add(new SelectListItem { Text = item.CategoryName, Value = item.CategoryId.ToString() }); } CSelectList.Insert(0, new SelectListItem() { Value = "", Text = "Select Category" }); // CSelectList.Insert(1, new SelectListItem() { Value = "0", Text = "All" }); ViewBag.CategoryList = CSelectList; } } //string preurl = GetUrl(2); //preurl = preurl + "ProductMaster/GetAllProductList"; //ProductMasterModelRootObject pobj = new ProductMasterModelRootObject(); ////List<ProductMasterModel> Prlist = new List<ProductMasterModel>(); //using (HttpClient prclient = new HttpClient()) //{ // HttpResponseMessage responseMessage = await prclient.GetAsync(preurl); // if (responseMessage.IsSuccessStatusCode) // { // var result = responseMessage.Content.ReadAsStringAsync().Result; // pobj = JsonConvert.DeserializeObject<ProductMasterModelRootObject>(result); // IList<SelectListItem> ProSelectList = new List<SelectListItem>(); // foreach (var item in pobj.data) // { // ProSelectList.Add(new SelectListItem { Text = item.ProductName, Value = item.ProductId.ToString() }); // } // ProSelectList.Insert(0, new SelectListItem() { Value = "", Text = "Select Product" }); // ProSelectList.Insert(1, new SelectListItem() { Value = "0", Text = "All" }); // ViewBag.ProductList = ProSelectList; // } //} ProductMasterModel product = (ProductMasterModel)TempData["item"]; return(View(product)); }
public async Task <ActionResult> AddNewProduct(FormCollection fc, HttpPostedFileBase file) { //if (ModelState.IsValid) //{ int ProductId = 0; ProductMasterModel model = new ProductMasterModel(); string productId = fc["ProductId"]; string CategoryName = fc["CategoryName"]; string ProductName = fc["ProductName"]; string UnitPrice = fc["UnitPrice"]; string GST = fc["GST"]; string Discount = fc["Discount"]; string TaxType = fc["TaxType"]; bool Lock = Convert.ToBoolean(fc["Lock"].Split(',')[0]);; string UOM = fc["UOM"]; string ProductDetails = fc["ProductDetails"]; string DeliveryCharge = fc["DeliveryCharge"]; //string ProductId = Convert.ToString(model.ProductId); //string ProductDetails = model.ProductDetails; //string CategoryName = model.CategoryName; //string ProductName = model.ProductName; //string UnitPrice = Convert.ToString(model.UnitPrice); //string GST = Convert.ToString(model.GST); //string Discount = Convert.ToString(model.Discount); //string TaxType = Convert.ToString(model.TaxType); ////bool Lock = Convert.ToBoolean(fc["Lock"].Split(',')[0]); ; //bool Lock = model.Lock; //string UOM = Convert.ToString(model.UOM); ////string ProductDetails = fc["ProductDetails"]; string url = GetUrl(2); url = url + "Product/AddNewProduct?ProductId=" + productId + "&CategoryName=" + CategoryName + "&ProductName=" + ProductName + "&UnitPrice=" + UnitPrice + "&GST=" + GST + "&Discount=" + Discount + "&TaxType=" + TaxType + "&Lock=" + Lock + "&UOM=" + UOM + "&ProductDetails=" + ProductDetails + "&DeliveryCharge=" + DeliveryCharge + ""; using (HttpClient client = new HttpClient()) { HttpResponseMessage responseMessage = await client.GetAsync(url); ProductMasterModelSingleRootObject result = new ProductMasterModelSingleRootObject(); if (responseMessage.IsSuccessStatusCode) { var response = responseMessage.Content.ReadAsStringAsync().Result; var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }; result = JsonConvert.DeserializeObject <ProductMasterModelSingleRootObject>(response, settings); if (result.data.ProductId == 0) { ProductId = Convert.ToInt32(productId); } else { ProductId = result.data.ProductId; } if (ProductId > 0) { try { var allowedExtensions = new[] { ".Jpg", ".png", ".jpg", "jpeg", ".JPG", }; //string imagepath = "http://103.233.79.234/Data/SJB_Android/LocalityPictures/"; model.ProductPicturesUrl = file.ToString(); //getting complete url var fileName = Path.GetFileName(file.FileName); //getting only file name(ex-ganesh.jpg) var ext = Path.GetExtension(file.FileName); //getting the extension(ex-.jpg) if (allowedExtensions.Contains(ext)) //check what type of extension { string name = Path.GetFileNameWithoutExtension(fileName); //getting file name without extension string myfile = +ProductId + ext; //appending the name with id // store the file inside ~/project folder(Img) //var path = Path.Combine(imagepath, myfile); string path = @"C:\inetpub\wwwroot\Data\SJB_Android\ProductPictures\" + Server.HtmlEncode(myfile); model.ProductPicturesUrl = path; //file.SaveAs(path); var fInfo = new FileInfo(myfile); if (!fInfo.Exists) { file.SaveAs(path); } else { System.IO.File.Copy(path, path, true); } } } catch (Exception ex) { } } else { ViewBag.message = "Please choose only Image file"; } } return(RedirectToAction("Index")); } //} //else //{ // return RedirectToAction("Index"); //} }