public static InwardEntryEntity[] GetINData(InwardEntryDateFilterEntity obj) { var details = new List <InwardEntryEntity>(); try { details = new InwardEntryDAO().GetInwardEntryList(obj); } catch (Exception ex) { // details.Add(new DbStatusEntity(ex.Message)); } return(details.ToArray()); }
public List <InwardEntryEntity> GetInwardEntryList(InwardEntryDateFilterEntity obj) { string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; SqlDataAdapter adapter; DataSet ds = new DataSet(); List <InwardEntryEntity> retlst = new List <InwardEntryEntity>(); try { using (SqlConnection con = new SqlConnection(CS)) { SqlCommand cmd = new SqlCommand("USP_GetInwardEntryMainList", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@DateFrom", obj.DateFrom); cmd.Parameters.AddWithValue("@DateTo", obj.DateTo); con.Open(); adapter = new SqlDataAdapter(cmd); adapter.Fill(ds); for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) { InwardEntryEntity obj1 = new InwardEntryEntity(); obj1.ID = Convert.ToInt64(ds.Tables[0].Rows[i]["ID"]); obj1.TRANS_NO = ds.Tables[0].Rows[i]["TRANS_NO"] != DBNull.Value ? Convert.ToInt64(ds.Tables[0].Rows[i]["TRANS_NO"]) : 0; if (ds.Tables[0].Rows[i]["TRANS_DATE"] != DBNull.Value) { obj1.TRANS_DATE = Convert.ToString(ds.Tables[0].Rows[i]["TRANS_DATE"]); } obj1.LED_NAME = ds.Tables[0].Rows[i]["LED_NAME"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["LED_NAME"].ToString(); obj1.REMARKS = ds.Tables[0].Rows[i]["REMARKS"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["REMARKS"].ToString(); obj1.VOID_STATUS = ds.Tables[0].Rows[i]["VOID_STATUS"] == DBNull.Value ? false : Convert.ToBoolean(ds.Tables[0].Rows[i]["VOID_STATUS"]); obj1.CREATEDBY = ds.Tables[0].Rows[i]["CREATEDBY"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["CREATEDBY"].ToString(); obj1.MODIFIEDBY = ds.Tables[0].Rows[i]["MODIFIEDBY"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["MODIFIEDBY"].ToString(); obj1.IN_TYPE_NAME = ds.Tables[0].Rows[i]["IN_TYPE_NAME"] == DBNull.Value ? "" : ds.Tables[0].Rows[i]["IN_TYPE_NAME"].ToString(); retlst.Add(obj1); } } } catch (Exception ex) { throw ex; } return(retlst); }