public static ManageResult manage(NameValueCollection querystring, NameValueCollection formdata) { UserProfile userProfile = WebCommon.GetUserProfile(); var CAList = new List <CAForLtoCV>(); string strData1; int intParser; decimal decimalParser; strData1 = formdata[0].ToString().Substring(formdata[0].ToString().IndexOf("],[") + 1, formdata[0].Length - formdata[0].ToString().IndexOf("],[") - 1); CAList = (List <CAForLtoCV>)CAList.ToClass(strData1); var ltocv = new LtoCheckVoucher { intIDLtoCV = int.TryParse(querystring.Get("intIDLtoCV"), out intParser) ? intParser : 0, intIDMasLocationUser = int.TryParse(querystring.Get("intIDMasLocation"), out intParser) ? intParser : 0, CheckNo = querystring.Get("CheckNo"), TransactionDate = querystring.Get("TransactionDate"), Amount = decimal.TryParse(querystring.Get("Amount"), out decimalParser) ? decimalParser : 0, AREmpAmount = decimal.TryParse(querystring.Get("AREmpAmount"), out decimalParser) ? decimalParser : 0, BankChargeAmount = decimal.TryParse(querystring.Get("BankChargeAmount"), out decimalParser) ? decimalParser : 0, Particulars = querystring.Get("Particulars"), intIDSecUser = int.TryParse(userProfile.UserId.ToString(), out intParser) ? intParser : 0, intIDMasBankAccount = int.TryParse(querystring.Get("intIDMasBankAccount"), out intParser) ? intParser : 0, CAListForLtoCV = CAList }; string isInsert = querystring.Get("TransType"); string param = WebCommon.ToXML(ltocv); return(LtoCheckVoucherDal.manage(param, isInsert)); }
public static List <LtoCheckVoucher> getLtoCV(string strCriteria, int intIDMasLocation) { var mstList = new List <LtoCheckVoucher>(); var dbUtil = new DatabaseManager(); using (var conn = new SqlConnection(dbUtil.getSQLConnectionString("MainDB"))) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "spLtoCV_GetLtoCV"; cmd.CommandTimeout = 180; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@strCriteria", strCriteria); cmd.Parameters.AddWithValue("@intIDMasLocation", intIDMasLocation); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var mst = new LtoCheckVoucher { intIDLtoCV = ReferenceEquals(reader["intIDLtoCV"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intIDLtoCV"]), intIDMasLocationUser = ReferenceEquals(reader["intIDMasLocationUser"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intIDMasLocationUser"]), CheckNo = ReferenceEquals(reader["CheckNo"], DBNull.Value) ? string.Empty : Convert.ToString(reader["CheckNo"]), TransactionDate = ReferenceEquals(reader["TransactionDate"], DBNull.Value) ? string.Empty : Convert.ToString(reader["TransactionDate"]), Amount = ReferenceEquals(reader["Amount"], DBNull.Value) ? 0 : Convert.ToDecimal(reader["Amount"]), AREmpAmount = decimal.Parse(reader["AREmpAmount"].ToString()), BankChargeAmount = decimal.Parse(reader["BankChargeAmount"].ToString()), Particulars = ReferenceEquals(reader["Particulars"], DBNull.Value) ? string.Empty : Convert.ToString(reader["Particulars"]), intIDSecUser = ReferenceEquals(reader["intIDSecUser"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intIDSecUser"]), intIDMasBankAccount = ReferenceEquals(reader["intIDMasBankAccount"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intIDMasBankAccount"]) }; mstList.Add(mst); } } } } return(mstList); }