private void Manage()
    {
        string result = BillingPurchasePaymentBAL.Manage(Request.QueryString, Request.Form);

        var billingPurchaseVoucher = new BillingPurchasePayment {
            BPPID = Convert.ToInt32(result.Split(',')[0]),
            BPPNo = Convert.ToInt32(result.Split(',')[1])
        };

        Response.Write(billingPurchaseVoucher.ToJSON());
    }
        public static List <BillingPurchasePayment> GetBillingPurchasePayment(string criteria, int branchid)
        {
            var dbUtil = new DatabaseManager();
            var bprs   = new List <BillingPurchasePayment>();

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

                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var bpr = new BillingPurchasePayment
                            {
                                BPPID        = ReferenceEquals(reader["intBPPID"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intBPPID"]),
                                BookTypeID   = ReferenceEquals(reader["intBookTypeID"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intBookTypeID"]),
                                BookType     = ReferenceEquals(reader["strBookType"], DBNull.Value) ? String.Empty : Convert.ToString(reader["strBookType"]),
                                BranchID     = ReferenceEquals(reader["intBranchID"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intBranchID"]),
                                BPPNo        = ReferenceEquals(reader["intBPPNo"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intBPPNo"]),
                                BPPDate      = ReferenceEquals(reader["datBPPDate"], DBNull.Value) ? String.Empty : Convert.ToString(reader["datBPPDate"]),
                                SupplierID   = ReferenceEquals(reader["intSupplierID"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intSupplierID"]),
                                SupplierCode = ReferenceEquals(reader["strSupplierCode"], DBNull.Value) ? String.Empty : Convert.ToString(reader["strSupplierCode"]),
                                SupplierName = ReferenceEquals(reader["strSupplierName"], DBNull.Value) ? String.Empty : Convert.ToString(reader["strSupplierName"]),
                                ChequeNo     = ReferenceEquals(reader["strChequeNo"], DBNull.Value) ? String.Empty : Convert.ToString(reader["strChequeNo"]),
                                ChequeDate   = ReferenceEquals(reader["datChequeDate"], DBNull.Value) ? String.Empty : Convert.ToString(reader["datChequeDate"]),
                                ChequeAmount = ReferenceEquals(reader["curChequeAmount"], DBNull.Value) ? 0 : Convert.ToDecimal(reader["curChequeAmount"]),
                                Remarks      = ReferenceEquals(reader["strRemarks"], DBNull.Value) ? String.Empty : Convert.ToString(reader["strRemarks"])
                                               //Vatable = ReferenceEquals(reader["Vatable"], DBNull.Value) ? 0 : Convert.ToDecimal(reader["Vatable"]),
                                               //EWTAmt = ReferenceEquals(reader["EWTAmt"], DBNull.Value) ? 0 : Convert.ToDecimal(reader["EWTAmt"])
                            };

                            bprs.Add(bpr);
                        }

                        return(bprs);
                    }
                }
            }
        }
コード例 #3
0
        public static string Manage(NameValueCollection querystring, NameValueCollection formdata)
        {
            string  isInsert = querystring.Get("TransType");
            int     intParser;
            decimal decParser;

            UserProfile userProfile = WebCommon.GetUserProfile();

            var bprDetails = new List <BPPDetail>();

            bprDetails = (List <BPPDetail>)bprDetails.ToClass(formdata["DetailData"]);

            var bprEntryLedgers = new List <BPREntryLedger>();

            bprEntryLedgers = (List <BPREntryLedger>)bprEntryLedgers.ToClass(formdata["EntryData"]);


            var billingPurchaseVoucher = new BillingPurchasePayment
            {
                BPPID           = int.TryParse(querystring.Get("BPPID"), out intParser) ? intParser : 0,
                BookTypeID      = int.TryParse(querystring.Get("BookTypeID"), out intParser) ? intParser : 0,
                BranchID        = int.TryParse(querystring.Get("BranchID"), out intParser) ? intParser : 0,
                BPPNo           = int.TryParse(querystring.Get("BPPNo"), out intParser) ? intParser : 0,
                BPPDate         = querystring.Get("BPPDate"),
                SupplierID      = int.TryParse(querystring.Get("SupplierID"), out intParser) ? intParser : 0,
                ChequeNo        = querystring.Get("ChequeNo"),
                ChequeDate      = querystring.Get("ChequeDate"),
                ChequeAmount    = decimal.TryParse(querystring.Get("ChequeAmount"), out decParser) ? decParser : 0,
                Remarks         = querystring.Get("Remarks"),
                BPPDetails      = bprDetails,
                BPPEntryLedgers = bprEntryLedgers,
                UserID          = userProfile.UserId
            };

            string param = WebCommon.ToXML(billingPurchaseVoucher);

            return(BillingPurchasePaymentDAL.Manage(param, isInsert));
        }