public static List <Inventory_OutClass> getall() { List <Inventory_OutClass> list_item = new List <Inventory_OutClass>(); DataTable dt = getrecord1(); if (dt.Rows.Count > 0) { for (Int32 i = 0; i < dt.Rows.Count; i++) { Inventory_OutClass u = new Inventory_OutClass(); u.Inv_Out = Convert.ToInt32(dt.Rows[i]["Inv_Out"].ToString()); u.Quantity = Convert.ToInt32(dt.Rows[i]["Quantity"].ToString()); u.Dateof = dt.Rows[i]["DateOf"].ToString(); list_item.Add(u); } } else { //return list_item; } return(list_item); }
public static List <Inventory_OutClass> approve(string Sdate, string FromDate, string ItemdNames) { List <Inventory_OutClass> list_item = new List <Inventory_OutClass>(); DataTable dt = getrecord(Sdate, FromDate, ItemdNames); if (dt.Rows.Count > 0) { for (Int32 i = 0; i < dt.Rows.Count; i++) { Inventory_OutClass u = new Inventory_OutClass(); u.Quantity = Convert.ToInt32(dt.Rows[i]["Quantity"].ToString()); u.Dateof = dt.Rows[i]["DateOf"].ToString(); u.grn_id = Convert.ToInt32(dt.Rows[i]["grn_id"].ToString()); u.Date = dt.Rows[i]["date"].ToString(); list_item.Add(u); } } else { //return list_item; } return(list_item); }
public void Get_All_Inventory_Out(int iDisplayLength, int iDisplayStart, int iSortCol_0, string sSortDir_0, string sSearch) { int displayLength = iDisplayLength; int displayStart = iDisplayStart; int sortCol = iSortCol_0; string sortDir = sSortDir_0; string search = sSearch; string cs = ConfigurationManager.ConnectionStrings["DBMS"].ConnectionString; List <Inventory_OutClass> listEmployees = new List <Inventory_OutClass>(); int filteredCount = 0; using (SqlConnection con = new SqlConnection(cs)) { SqlCommand cmd = new SqlCommand("Sp_Get_Inventory_Out", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter paramDisplayLength = new SqlParameter() { ParameterName = "@DisplayLength", Value = displayLength }; cmd.Parameters.Add(paramDisplayLength); SqlParameter paramDisplayStart = new SqlParameter() { ParameterName = "@DisplayStart", Value = displayStart }; cmd.Parameters.Add(paramDisplayStart); SqlParameter paramSortCol = new SqlParameter() { ParameterName = "@SortCol", Value = sortCol }; cmd.Parameters.Add(paramSortCol); SqlParameter paramSortDir = new SqlParameter() { ParameterName = "@SortDir", Value = sortDir }; cmd.Parameters.Add(paramSortDir); SqlParameter paramSearchString = new SqlParameter() { ParameterName = "@Search", Value = string.IsNullOrEmpty(search) ? null : search }; cmd.Parameters.Add(paramSearchString); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { Inventory_OutClass emp = new Inventory_OutClass(); emp.Items_name = Convert.ToString(rdr["items_name"]); filteredCount = Convert.ToInt32(rdr["TotalCount"]); emp.Dateof = rdr["DateOf"].ToString(); emp.Quantity = Convert.ToInt32(rdr["Quantity"]); emp.grn_id = Convert.ToInt32(rdr["grn_id"]); emp.emp_name = Convert.ToString(rdr["emp_name"]); listEmployees.Add(emp); } } var result = new { iTotalRecords = GetInvOutTotalCount(), iTotalDisplayRecords = filteredCount, aaData = listEmployees }; JavaScriptSerializer js = new JavaScriptSerializer(); Context.Response.Write(js.Serialize(result)); }