Beispiel #1
0
        public static string Manage(NameValueCollection querystring, NameValueCollection formdata)
        {
            string  isInsert = querystring.Get("TransType");
            int     intParser;
            decimal decParser;

            UserProfile userProfile = WebCommon.GetUserProfile();

            var bprEntryLedgers = new List <GLEntries>();

            bprEntryLedgers = (List <GLEntries>)bprEntryLedgers.ToClass(formdata["Data"]);

            var bpradjustment = new BPRAdjustment
            {
                BPRAdjustmentID  = int.TryParse(querystring.Get("BPRAdjustmentID"), out intParser) ? intParser : 0,
                AdjustmentNo     = int.TryParse(querystring.Get("AdjustmentNo"), out intParser) ? intParser : 0,
                AdjustmentDate   = querystring.Get("AdjustmentDate"),
                BranchID         = int.TryParse(querystring.Get("BranchID"), out intParser) ? intParser : 0,
                AdjustmentTypeID = int.TryParse(querystring.Get("AdjustmentTypeID"), out intParser) ? intParser : 0,
                BPRID            = int.TryParse(querystring.Get("BPRID"), out intParser) ? intParser : 0,
                Total            = decimal.TryParse(querystring.Get("Total"), out decParser) ? decParser : 0,
                Remarks          = querystring.Get("Remarks"),
                Details          = bprEntryLedgers,
                UserID           = userProfile.UserId
            };

            string param = WebCommon.ToXML(bpradjustment);

            return(BPRAdjustmentDAL.Manage(param, isInsert));
        }
    private void Manage()
    {
        string result = BPRAdjustmentBAL.Manage(Request.QueryString, Request.Form);

        var bpradjustment = new BPRAdjustment
        {
            BPRAdjustmentID = Convert.ToInt32(result.Split(',')[0]),
            AdjustmentNo    = Convert.ToInt32(result.Split(',')[1])
        };

        Response.Write(bpradjustment.ToJSON());
    }
        public static List <BPRAdjustment> GetBPRAdjustment(int branchid, string criteria)
        {
            var dbUtil         = new DatabaseManager();
            var bpradjustments = new List <BPRAdjustment>();

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

                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var bpradjustment = new BPRAdjustment
                            {
                                budgetID   = ReferenceEquals(reader["intBudgetID"], DBNull.Value) ? 0 : (int)reader["intBudgetID"],
                                BranchName = ReferenceEquals(reader["strBranchName"], DBNull.Value) ? String.Empty : (string)reader["strBranchName"],
                                FiscalYear = ReferenceEquals(reader["intFiscalYear"], DBNull.Value) ? 0 : (int)reader["intFiscalYear"],
                                BranchID   = ReferenceEquals(reader["intBranchID"], DBNull.Value) ? 0 : (int)reader["intBranchID"]

                                             //BPRAdjustmentID = ReferenceEquals(reader["intBPRAdjustmentID"], DBNull.Value) ? 0 : (int)reader["intBPRAdjustmentID"],
                                             //AdjustmentNo = ReferenceEquals(reader["intAdjustmentNo"], DBNull.Value) ? 0 : (int)reader["intAdjustmentNo"],
                                             //BranchID = ReferenceEquals(reader["intBranchID"], DBNull.Value) ? 0 : (int)reader["intBranchID"],
                                             //AdjustmentTypeID = ReferenceEquals(reader["intAdjustmentTypeID"], DBNull.Value) ? 0 : (int)reader["intAdjustmentTypeID"],
                                             //AdjustmentType = ReferenceEquals(reader["strAdjustmentType"], DBNull.Value) ? String.Empty : (string)reader["strAdjustmentType"],
                                             //AdjustmentDate = ReferenceEquals(reader["datAdjustmentDate"], DBNull.Value) ? String.Empty : (string)reader["datAdjustmentDate"],
                                             //SupplierName = ReferenceEquals(reader["strSupplierName"], DBNull.Value) ? String.Empty : (string)reader["strSupplierName"],
                                             //BPRID = ReferenceEquals(reader["intBPRID"], DBNull.Value) ? 0 : (int)reader["intBPRID"],
                                             //BPRNo = ReferenceEquals(reader["intBPRNo"], DBNull.Value) ? 0 : (int)reader["intBPRNo"],
                                             //SINo = ReferenceEquals(reader["intSINo"], DBNull.Value) ? 0 : (int)reader["intSINo"],
                                             //Total = ReferenceEquals(reader["curTotal"], DBNull.Value) ? 0 : (decimal)reader["curTotal"],
                                             //Remarks = ReferenceEquals(reader["strRemarks"], DBNull.Value) ? String.Empty : (string)reader["strRemarks"]
                            };

                            bpradjustments.Add(bpradjustment);
                        }
                    }
                }
            }

            return(bpradjustments);
        }