Ejemplo n.º 1
0
        public void EditDiscount(std_discount mst)
        {
            try
            {
                using (MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
                {
                    string query = @"UPDATE std_discount 
                                    SET 
                                        acc_id = @acc_id,
                                        percent = @percent,
                                        bl_exempt = @bl_exempt,
                                        bl_apr = @bl_apr,
                                        bl_may = @bl_may,
                                        bl_jun = @bl_jun,
                                        bl_jul = @bl_jul,
                                        bl_aug = @bl_aug,
                                        bl_sep = @bl_sep,
                                        bl_oct = @bl_oct,
                                        bl_nov = @bl_nov,
                                        bl_dec = @bl_dec,
                                        bl_jan = @bl_jan,
                                        bl_feb = @bl_feb,
                                        bl_mar = @bl_mar,
                                        remark = @std_remarks
                                    WHERE
                                        sr_num = @sr_num AND acc_id = @acc_id
                                            AND session = (SELECT 
                                                session
                                            FROM
                                                mst_session
                                            WHERE
                                                session_finalize = 'Y'
                                                    AND session_active = 'Y')";

                    con.Execute(query, mst);

                    var p = new DynamicParameters();
                    p.Add("@sr_num", mst.sr_num);
                    p.Add("@ac_id", mst.acc_id);
                    con.Execute("stdMiddiscount", p, commandType: System.Data.CommandType.StoredProcedure);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public void AddFees(std_discount std)
        {
            try
            {
                using (MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
                {
                    mst_sessionMain sess = new mst_sessionMain();

                    string query = @"INSERT INTO std_discount
                                   (session
                                   ,sr_num
                                   ,acc_id
                                   ,percent
                                   ,bl_exempt
                                   ,bl_apr
                                   ,bl_may
                                   ,bl_jun
                                   ,bl_jul
                                   ,bl_aug
                                   ,bl_sep
                                   ,bl_oct
                                   ,bl_nov
                                   ,bl_dec
                                   ,bl_jan
                                   ,bl_feb
                                   ,bl_mar
                                   ,remark)
                                     VALUES
                                    (@session
                                    ,@sr_num
                                   ,@acc_id
                                   ,@percent
                                   ,@bl_exempt
                                   ,@bl_apr
                                   ,@bl_may
                                   ,@bl_jun
                                   ,@bl_jul
                                   ,@bl_aug
                                   ,@bl_sep
                                   ,@bl_oct
                                   ,@bl_nov
                                   ,@bl_dec
                                   ,@bl_jan
                                   ,@bl_feb
                                   ,@bl_mar
                                   ,@std_remarks)";

                    std.session = sess.findActive_finalSession();

                    con.Execute(query, new
                    {
                        std.session,
                        std.sr_num,
                        std.acc_id,
                        std.percent,
                        std.bl_exempt,
                        std.bl_apr,
                        std.bl_may,
                        std.bl_jun,
                        std.bl_jul,
                        std.bl_aug,
                        std.bl_sep,
                        std.bl_oct,
                        std.bl_nov,
                        std.bl_dec,
                        std.bl_jan,
                        std.bl_feb,
                        std.bl_mar,
                        std.std_remarks
                    });

                    var p = new DynamicParameters();
                    p.Add("@sr_num", std.sr_num);
                    p.Add("@ac_id", std.acc_id);
                    con.Execute("stdMiddiscount", p, commandType: System.Data.CommandType.StoredProcedure);
                }
            }
            catch
            {
                throw;
            }
        }