public ActionResult GetItemByID(int itemId) { BO_Item obj = new BussinessObject.BO_Item(); obj = BL_Item.GetItemByID(itemId); return(Json(obj, JsonRequestBehavior.AllowGet)); }
//Get Generated Item Code #region [Get Item Code] private string GetItemCode() { try { EWA_Item objEWA = new EWA_Item(); BL_Item objBL = new BL_Item(); float CategoryId = db.getDb_Value("SELECT CategoryId FROM tblCategory where OrgId='" + orgId.ToString() + "' "); objEWA.CategoryId = CategoryId.ToString(); DataSet dsData = objBL.GetItemCode_BL(objEWA); string ItemCode = string.Empty; if (dsData.Tables[0].Rows.Count > 0) { ItemCode = dsData.Tables[0].Rows[0][0].ToString(); } return(ItemCode); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); return(""); } }
public void DownloadExcel(JQueryDataTableParamModel Param) { try { string tmpDirPath = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data/temp/"); string DetagalioReportTemplate = "Master_Template_Excel"; string getfile = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data/getexcel/" + DetagalioReportTemplate + ".xlsx"); string masterfilePath = tmpDirPath + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xlsx"; var existingFile = new FileInfo(getfile); existingFile = existingFile.CopyTo(masterfilePath); var obj = BL_Item.LoadItems(Param); //var obj = BL_FilePortalDownloadFile.GetFilePortalDownloadDataForExcel(Param, Request); FormatExcelItemReports(obj.ToList(), masterfilePath); using (var package = new ExcelPackage(existingFile)) { //Get the work book in the file var workBook = package.Workbook; if (workBook != null) { var exportData = new MemoryStream(); workBook.Worksheets.Delete(1); package.SaveAs(exportData); string saveAsFileName = ("Item " + DateTime.Now.ToString("yyyy-MM-dd HH-mm") + ".xlsx").Replace(" / ", " - "); Response.Clear(); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", saveAsFileName)); Response.Cookies["ava_cv"].Value = Request.QueryString["cv"]; Response.Cookies["ava_cv"].Expires = DateTime.UtcNow.AddMinutes(5); Response.BinaryWrite(exportData.ToArray()); Response.Flush(); Response.End(); } } string[] files = System.IO.Directory.GetFiles(tmpDirPath, "*.xlsx"); if (files.Any()) { foreach (string file in files) { System.IO.File.Delete(file); } } } finally { Response.Cookies["ava_cv"].Value = Request.QueryString["cv"]; Response.Cookies["ava_cv"].Expires = DateTime.UtcNow.AddMinutes(5); } }
//Grid Index Changed #region GrdIndexChanged protected void GrdItem_PageIndexChanging(object sender, GridViewPageEventArgs e) { try { BL_Item objBL = new BL_Item(); GrdItem.PageIndex = e.NewPageIndex; GrdItem.DataSource = objBL.BindItemGrid_BL(); GrdItem.DataBind(); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Check Data #region [Check Data] private int CheckData() { int i = 0; try { EWA_Item objEWA = new EWA_Item(); BL_Item objBL = new BL_Item(); objEWA.ItemName = txtItemName.Text.Trim(); i = objBL.CheckDuplicateItem_BL(objEWA); return(i); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); return(0); } }
private void BindUnit() { try { EWA_Item objEWA = new EWA_Item(); BL_Item objBL = new BL_Item(); //objEWA.OrgId = orgId; objEWA.OrgId = Convert.ToInt32(Session["OrgId"]); DataSet dsUnit = objBL.BindUnit_BL(objEWA); ddlUnit.DataSource = dsUnit; ddlUnit.DataValueField = "UnitId"; ddlUnit.DataTextField = "UnitName"; ddlUnit.DataBind(); ddlUnit.Items.Insert(0, "Select"); //if (ddlCategory.Items.Count <= 1) //{ // using (SqlCommand cmd = new SqlCommand(" SELECT UnitName, UnitId FROM tblUnit where OrgId='" + orgId.ToString() + "' ")) // { // cmd.CommandType = CommandType.Text; // cmd.Connection = cn; // cn.Open(); // ddlCategory.DataSource = cmd.ExecuteReader(); // ddlCategory.DataValueField = "UnitId"; // ddlCategory.DataTextField = "UnitName"; // ddlCategory.DataBind(); // cn.Close(); // } // ddlCategory.Items.Insert(0, new ListItem("--Select Unit--")); //} } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
public string GetOilGradeData() { return(BL_Common.Serialize(BL_Item.GetOilGradeData())); }
public string GetActingAccounts() { var List = BL_Item.GetActingAccounts(); return(BL_Common.Serialize(List)); }
public JsonResult GetServiceNameList() { var List = BL_Item.GetServiceNameList(); return(Json(List, JsonRequestBehavior.AllowGet)); }
public string GetItemQuantityforSale(int itemId) { string qty = BL_Item.GetItemQuantityforSale(itemId).ToString(); return(BL_Common.Serialize(qty)); }
public string DeleteItem(int itemId) { var pl = BL_Item.DeleteItem(itemId, UserAprosysAccounting.id); return(BL_Common.Serialize(pl)); }
public ActionResult LoadItemTable(JQueryDataTableParamModel Param) { MYJSONTblCustom MYJSON = BL_Item.LoadItemTable(Param, Request); return(Json(MYJSON, JsonRequestBehavior.AllowGet)); }
public string SaveItem(string paramitem) { var _item = BL_Common.Deserialize <BO_Item>(paramitem); return(BL_Common.Serialize(BL_Item.SaveItem(_item, UserAprosysAccounting.id))); }