public static string ManageRevolvingFund(NameValueCollection querystring, NameValueCollection formdata) { int intParser; decimal decimalParser; UserProfile userProfile = WebCommon.GetUserProfile(); var revolvingFundDetails = new List <RevolvingFundDetail>(); revolvingFundDetails = (List <RevolvingFundDetail>)revolvingFundDetails.ToClass(formdata["Data"]); var revolvingFund = new RevolvingFund { RFID = int.TryParse(querystring.Get("RFID"), out intParser) ? intParser : 0, BranchID = int.TryParse(querystring.Get("BranchID"), out intParser) ? intParser : 0, RFNo = querystring.Get("RFNo"), RFDate = querystring.Get("RFDate"), PayeeID = int.TryParse(querystring.Get("PayeeID"), out intParser) ? intParser : 0, CheckNo = querystring.Get("CheckNo"), CheckDate = querystring.Get("CheckDate"), CheckAmount = decimal.TryParse(querystring.Get("Checkmount"), out decimalParser) ? decimalParser : 0, Particulars = querystring.Get("Particulars"), Details = revolvingFundDetails, UserID = userProfile.UserId }; string isInsert = querystring.Get("TransType"); string param = WebCommon.ToXML(revolvingFund); return(RevolvingFundDAL.ManageRevolvingFund(param, isInsert)); }
public static List <RevolvingFund> GetRevolvingFund(string criteria, int branchid) { var dbUtil = new DatabaseManager(); var revolvingFunds = new List <RevolvingFund>(); using (var conn = new SqlConnection(dbUtil.getSQLConnectionString("MainDB"))) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "spAcctGetRevFundHeader"; cmd.CommandTimeout = 180; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@strCriteria", criteria); cmd.Parameters.AddWithValue("@intIDMasLocation", branchid); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var revolvingFund = new RevolvingFund { RFID = ReferenceEquals(reader["intRFID"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intRFID"]), BranchID = ReferenceEquals(reader["intBranchID"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intBranchID"]), RFNo = ReferenceEquals(reader["strRFNo"], DBNull.Value) ? String.Empty : Convert.ToString(reader["strRFNo"]), RFDate = ReferenceEquals(reader["datRFDate"], DBNull.Value) ? String.Empty : Convert.ToString(reader["datRFDate"]), PayeeID = ReferenceEquals(reader["intPayeeID"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intPayeeID"]), Payee = ReferenceEquals(reader["strPayee"], DBNull.Value) ? String.Empty : Convert.ToString(reader["strPayee"]), CheckNo = ReferenceEquals(reader["strCheckNo"], DBNull.Value) ? String.Empty : Convert.ToString(reader["strCheckNo"]), CheckDate = ReferenceEquals(reader["datCheckDate"], DBNull.Value) ? String.Empty : Convert.ToString(reader["datCheckDate"]), CheckAmount = ReferenceEquals(reader["curCheckAmount"], DBNull.Value) ? 0 : Convert.ToDecimal(reader["curCheckAmount"]), Particulars = ReferenceEquals(reader["strParticualrs"], DBNull.Value) ? String.Empty : Convert.ToString(reader["strParticualrs"]), IsPosted = !ReferenceEquals(reader["blnIsPosted"], DBNull.Value) && Convert.ToBoolean(reader["blnIsPosted"]), IsFinalPosted = !ReferenceEquals(reader["blnIsFinalPosted"], DBNull.Value) && Convert.ToBoolean(reader["blnIsFinalPosted"]) }; revolvingFunds.Add(revolvingFund); } return(revolvingFunds); } } } }
private void Manage() { try { string result = RevolvingFundBAL.ManageRevolvingFund(Request.QueryString, Request.Form); var revolvingfund = new RevolvingFund { RFID = Convert.ToInt32(result.Split(',')[0]), RFNo = result.Split(',')[1] }; Response.Write(revolvingfund.ToJSON()); } catch (Exception ex) { var appError = new ApplicationError { ErrorMessage = ex.Message, ErrorCode = 999 }; Response.Write(appError.ToJSON()); } }