public string SaveStockTaken(StockTakenModel ob) { try { _sql = "SaveStockTaken"; _parms = new SqlParameter[9]; _parms[0] = new SqlParameter("@StockTakingId", SqlDbType.Int); _parms[0].Value = ob.StockTakingId; _parms[1] = new SqlParameter("@StoreId", SqlDbType.Int); _parms[1].Value = ob.StoreId; _parms[2] = new SqlParameter("@BDate", SqlDbType.DateTime); _parms[2].Value = ob.BDate; _parms[3] = new SqlParameter("@InventoryTime", SqlDbType.Int); _parms[3].Value = ob.InventoryTime; _parms[4] = new SqlParameter("@Status", SqlDbType.Int); _parms[4].Value = ob.Status; _parms[5] = new SqlParameter("@StocktakingTypeId", SqlDbType.Int); _parms[5].Value = ob.StocktakingTypeId; _parms[6] = new SqlParameter("@UserId", SqlDbType.Int); _parms[6].Value = ob.UserId; _parms[7] = new SqlParameter("@ListData", SqlDbType.NVarChar); _parms[7].Value = ob.strCountSheetModel; _parms[8] = new SqlParameter("@ReturnValue", SqlDbType.NVarChar, 1000); _parms[8].Direction = ParameterDirection.Output; return(Convert.ToString(RunProcedure(_sql, "@ReturnValue", _parms))); } catch (Exception ex) { return(ex.ToString()); } }
public async Task <ActionResult> CountSheet(int StockTakingId) { string url = StVariable.ApiUri + "/api/StockTaken/GetStockTakenDetail?Qtype=ID&StockTakingId=" + StockTakingId; StockTakenModel model = null; client.BaseAddress = new Uri(url); HttpResponseMessage responseMessage = await client.GetAsync(url); if (responseMessage.IsSuccessStatusCode) { var responseData = responseMessage.Content.ReadAsStringAsync().Result; model = JsonConvert.DeserializeObject <StockTakenModel>(responseData); } return(View(model)); }
public StockTakenModel DisplayStockTakenDetail(string Qtype, int StockTakingId) { StockTakenModel objlist = new StockTakenModel(); DataSet ds = obj.DisplayStockTaken(Qtype, StockTakingId, 0, 0, DateTime.Now, DateTime.Now); if (ds.Tables[0].Rows.Count > 0) { objlist = ds.Tables[0].AsEnumerable().Select(x => new StockTakenModel { StockTakingId = x.Field <int>("StockTakingId"), StoreId = x.Field <int>("StoreId"), StoreName = x.Field <String>("StoreName"), BDate = x.Field <DateTime>("BDate"), InventoryTime = x.Field <int>("InventoryTime"), Status = x.Field <int>("Status"), StocktakingTypeId = x.Field <int>("StocktakingTypeId"), StocktakingType = x.Field <string>("StocktakingType"), ActualAmount = x.Field <decimal>("ActualAmount"), TheoAmount = x.Field <decimal>("TheoAmount"), VarAmount = x.Field <decimal>("VarAmount"), CreatedBy = x.Field <string>("CreatedBy"), CreatedOn = x.Field <string>("CreatedOn"), ModifiedBy = x.Field <string>("ModifiedBy"), ModifiedOn = x.Field <string>("ModifiedOn") }).FirstOrDefault(); } if (ds.Tables[1].Rows.Count > 0) { objlist.lstCountSheetModel = ds.Tables[1].AsEnumerable().Select(x => new CountSheetModel { StockTakingId = x.Field <int>("StockTakingId"), ItemId = x.Field <int>("ItemId"), ItemCode = x.Field <int>("ItemCode"), ItemName = x.Field <string>("ItemName"), Qty = x.Field <decimal>("Qty"), UnitName = x.Field <string>("UnitName"), YesterdayActQty = x.Field <decimal>("YesterdayActQty"), SaleQty = x.Field <decimal>("SaleQty"), TheoAmount = x.Field <decimal>("TheoAmount"), ActualQty = x.Field <decimal>("ActualQty"), ActualAmount = x.Field <decimal>("ActualAmount"), VarQty = x.Field <decimal>("VarQty"), VarAmount = x.Field <decimal>("VarAmount"), ActualCost = x.Field <decimal>("ActualCost") }).ToList(); } return(objlist); }
public async Task <ActionResult> Create(StockTakenModel ob) { ob.UserId = objSessionManager.UserID; string url = StVariable.ApiUri + "/api/StockTaken/SaveStockTaken"; if (ModelState.IsValid) { client.BaseAddress = new Uri(url); HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url, ob); if (responseMessage.IsSuccessStatusCode) { var responseData = responseMessage.Content.ReadAsStringAsync().Result; return(Json(new { success = true, StockTakingId = responseData }, JsonRequestBehavior.AllowGet)); } } return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); }
public async Task <JsonResult> CheckInventory(StockTakenModel ob) { try { string url = StVariable.ApiUri + "/api/StockTaking/CheckStockTaken?Qtype=ID&StocktakingTypeId=" + ob.StocktakingTypeId + "&StoreId=" + ob.StoreId + "&BDate=" + ob.BDate; if (ModelState.IsValid) { client.BaseAddress = new Uri(url); HttpResponseMessage responseMessage = await client.GetAsync(url); if (responseMessage.IsSuccessStatusCode) { var responseData = responseMessage.Content.ReadAsStringAsync().Result; return(Json(new { success = 1, msg = responseData }, JsonRequestBehavior.AllowGet)); } } } catch (Exception ex) { } return(Json(new { success = "Error" }, JsonRequestBehavior.AllowGet)); //if (obj.Count > 0) //{ // return Json(new { success = 1 }, JsonRequestBehavior.AllowGet); //} //else if (obj1.Count > 0) //{ // return Json(new { success = 2 }, JsonRequestBehavior.AllowGet); //} //else if (st <= 0) //{ // return Json(new { success = 3 }, JsonRequestBehavior.AllowGet); //} //else //{ // return Json(new { success = 4 }, JsonRequestBehavior.AllowGet); //} }
public string SaveStockTaken(StockTakenModel objMedel) { return(obj.SaveStockTaken(objMedel)); }
//[ResponseType(typeof(StockTakenModel))] public IHttpActionResult SaveStockTaken(StockTakenModel ob) { string str = obj.SaveStockTaken(ob); return(Ok(str)); }