public static string Manage(NameValueCollection querystring)
        {
            int intParser;

            UserProfile userProfile = WebCommon.GetUserProfile();

            string isInsert = querystring.Get("transType");

            var BnkRecon = new AccountAdjustForm
            {
                ID = int.TryParse(querystring.Get("ID"), out intParser) ? intParser : 0,
                intIDMasLocation    = int.TryParse(querystring.Get("BranchID"), out intParser) ? intParser : 0,
                intIDAdjustmentType = int.TryParse(querystring.Get("AdjustmentType"), out intParser) ? intParser : 0,
                datPrepared         = querystring.Get("DatePrepared"),
                intIDBranchUser     = userProfile.UserId,
                intIDSalMCFinancing = int.TryParse(querystring.Get("SalesID"), out intParser) ? intParser : 0,
                strAccountCode      = querystring.Get("AccountCode"),
                strDescription      = querystring.Get("Description"),
                strJustification    = querystring.Get("Justification"),
            };

            string param = WebCommon.ToXML(BnkRecon);

            return(AccountAdjustmentFormDAL.Manage(param, isInsert));
        }
示例#2
0
        public static List <AccountAdjustForm> GetAdjustmentForm(string strCriteria, int intBranchID)
        {
            var dbUtil   = new DatabaseManager();
            var brDetail = new List <AccountAdjustForm>();

            using (var conn = new SqlConnection(dbUtil.getSQLConnectionString("MainDB")))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandType    = CommandType.StoredProcedure;
                    cmd.CommandText    = "spAccountAdjustFormGetTran";
                    cmd.CommandTimeout = 180;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@strCriteria", strCriteria);
                    cmd.Parameters.AddWithValue("@intBranchID", intBranchID);

                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var brdtl = new AccountAdjustForm
                            {
                                ID                  = ReferenceEquals(reader["ID"], DBNull.Value) ? 0 : Convert.ToInt32(reader["ID"]),
                                IDbranch            = ReferenceEquals(reader["IDBranch"], DBNull.Value) ? 0 : Convert.ToInt32(reader["IDBranch"]),
                                intIDMasLocation    = ReferenceEquals(reader["intIDMasLocation"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intIDMasLocation"]),
                                intIDAdjustmentType = ReferenceEquals(reader["intIDAdjustmentType"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intIDAdjustmentType"]),
                                intIDSalMCFinancing = ReferenceEquals(reader["intIDSalMCFinancing"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intIDSalMCFinancing"]),
                                datPrepared         = ReferenceEquals(reader["datPrepared"], DBNull.Value) ? String.Empty : Convert.ToString(reader["datPrepared"]),
                                strAccountCode      = ReferenceEquals(reader["strAccountCode"], DBNull.Value) ? string.Empty : Convert.ToString(reader["strAccountCode"]),
                                strAccountName      = ReferenceEquals(reader["strAccountName"], DBNull.Value) ? string.Empty : Convert.ToString(reader["strAccountName"]),
                                strDescription      = ReferenceEquals(reader["strDescription"], DBNull.Value) ? string.Empty : Convert.ToString(reader["strDescription"]),
                                strJustification    = ReferenceEquals(reader["strJustification"], DBNull.Value) ? string.Empty : Convert.ToString(reader["strJustification"]),
                                intIDBranchUser     = ReferenceEquals(reader["intIDBranchUser"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intIDBranchUser"])
                            };

                            brDetail.Add(brdtl);
                        }

                        return(brDetail);
                    }
                }
            }
        }