예제 #1
0
        public static ReqBrsPaymentList GetBrsPayment(ReqGetBrsPayment reqGetBrsPayment, string spName)
        {
            ReqBrsPaymentList    _reqBrsPaymentList = new ReqBrsPaymentList();
            List <ReqBrsPayment> reqBrsPaymentList  = new List <ReqBrsPayment>();
            DataTable            dt = new DataTable();

            try
            {
                using (SqlConnection con = new SqlConnection(StaticConst.connectionString))
                {
                    using (SqlCommand cmd = new SqlCommand(spName, con))
                    {
                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        con.Open();
                        cmd.Parameters.Add(new SqlParameter("@Id", reqGetBrsPayment.Id));
                        cmd.Parameters.Add(new SqlParameter("@Type", reqGetBrsPayment.Type));
                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            da.Fill(dt);
                            if (dt.Rows.Count > 0)
                            {
                                for (int i = 0; i < dt.Rows.Count; i++)
                                {
                                    ReqBrsPayment resqBrsPayment = new ReqBrsPayment();
                                    resqBrsPayment.Amount          = Convert.ToString(dt.Rows[i]["Amount"]);
                                    resqBrsPayment.Id              = Convert.ToInt16(dt.Rows[i]["Id"]);
                                    resqBrsPayment.Memo            = Convert.ToString(dt.Rows[i]["Memo"]);
                                    resqBrsPayment.ModeNo          = Convert.ToString(dt.Rows[i]["ModeNo"]);
                                    resqBrsPayment.PaidDate        = Convert.ToString(dt.Rows[i]["PaidDate"]);
                                    resqBrsPayment.PaymentMode     = Convert.ToString(dt.Rows[i]["PaymentMode"]);
                                    resqBrsPayment.RealizationDate = Convert.ToString(dt.Rows[i]["RealizationDate"]);

                                    reqBrsPaymentList.Add(resqBrsPayment);
                                }
                                _reqBrsPaymentList.reqBrsPaymentList = reqBrsPaymentList;
                                _reqBrsPaymentList.ResponseCode      = 0;
                                _reqBrsPaymentList.ResponseMessage   = "Fetched Detail Successfully";
                            }
                            else
                            {
                                _reqBrsPaymentList.ResponseCode    = 0;
                                _reqBrsPaymentList.ResponseMessage = "No Records found";
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(_reqBrsPaymentList);
        }
예제 #2
0
        public static ResCommon InsertBrsPayment(ReqBrsPaymentList reqBrsPayment, string spName)
        {
            ResCommon resCommon = new ResCommon();

            DataTable dt = new DataTable();

            try
            {
                using (SqlConnection con = new SqlConnection(StaticConst.connectionString))
                {
                    using (SqlCommand cmd = new SqlCommand(spName, con))
                    {
                        string    json                = JsonConvert.SerializeObject(reqBrsPayment);
                        JObject   jObject             = JObject.Parse(json);
                        var       jarray              = Convert.ToString(jObject["reqBrsPaymentList"]);
                        DataTable dtReqBrsPaymentList = (DataTable)JsonConvert.DeserializeObject(jarray, (typeof(DataTable)));
                        dtReqBrsPaymentList.Columns.Remove("Type");
                        dtReqBrsPaymentList.Columns.Remove("ResponseMessage");
                        dtReqBrsPaymentList.Columns.Remove("ResponseCode");

                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        con.Open();

                        cmd.Parameters.Add(new SqlParameter("@BrsPaymentType", dtReqBrsPaymentList));
                        cmd.Parameters.Add(new SqlParameter("@Type", reqBrsPayment.Type));
                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            da.Fill(dt);
                            if (dt.Rows.Count > 0)
                            {
                                resCommon.ResponseCode    = 0;
                                resCommon.ResponseMessage = reqBrsPayment.Type + " Inserted Successfully";
                            }
                            else
                            {
                                resCommon.ResponseCode    = 0;
                                resCommon.ResponseMessage = "No Records Found";
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(resCommon);
        }
예제 #3
0
 public ResCommon UpdateBrsPayment(ReqBrsPaymentList reqUpdateBrsPayment)
 {
     return(BrsCall.UpdateBrsPayment(reqUpdateBrsPayment, StaticConst.SPUPDATEBRSPAYMENT));
 }
예제 #4
0
 public ResCommon InsertBrsPayment(ReqBrsPaymentList reqBrsPayment)
 {
     return(BrsCall.InsertBrsPayment(reqBrsPayment, StaticConst.SPINSERTBRSPAYMENT));
 }