示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Login"] == null || Session["Package"] == null)
            {
                Response.Redirect("/Authorization/Login");
            }

            package_login = (Base_Companys)Session["Package"];
            acc_lgn       = (Account_Login)Session["Login"];

            if (!IsPostBack)
            {
                if (Request.Params["code"] != null)
                {
                    string[] code = Request.Params["code"].Split('U');
                    string   id   = code[1];

                    if (Request.Params["mode"] == "e")
                    {
                        bs_class = bs_mng.getTotalPaymentById(Convert.ToInt32(id));

                        _loadData(bs_class);
                    }
                    else if (Request.Params["mode"] == "r")
                    {
                        _removeData(id);

                        Response.Redirect("/Form_Base/Base_Total_Payment_Management");
                    }
                }
            }
        }
        // ระยะเวลาชำระเงิน
        private void _loadTotalPaymentTime()
        {
            List <Base_Total_Payment> list_data = new Base_Total_Payment_Manager().getTotalPayment();

            TotalPaymentTime_DDL.Items.Add(new ListItem("--------กรุณาเลือก--------", "0"));
            for (int i = 0; i < list_data.Count; i++)
            {
                Base_Total_Payment data = list_data[i];
                TotalPaymentTime_DDL.Items.Add(new ListItem(data.Total_payment_name, data.Total_payment_id.ToString()));
            }
        }
        public List <Base_Total_Payment> getTotalPayment()
        {
            MySqlConnection con = MySQLConnection.connectionMySQL();

            try
            {
                con.Open();
                string          sql    = "SELECT * FROM base_total_payment";
                MySqlCommand    cmd    = new MySqlCommand(sql, con);
                MySqlDataReader reader = cmd.ExecuteReader();

                int    defaultNum    = 0;
                string defaultString = "";

                List <Base_Total_Payment> list_bs_t_pay = new List <Base_Total_Payment>();

                while (reader.Read())
                {
                    Base_Total_Payment bs_t_pay = new Base_Total_Payment();

                    bs_t_pay.Total_payment_id   = reader.IsDBNull(0) ? defaultNum : reader.GetInt32(0);
                    bs_t_pay.Total_payment_name = reader.IsDBNull(1) ? defaultString : reader.GetString(1);

                    list_bs_t_pay.Add(bs_t_pay);
                }

                return(list_bs_t_pay);
            }
            catch (MySqlException ex)
            {
                error = "MysqlException ==> Managers_Base --> Base_Total_Payment_Manager --> getTotalPayment() ";
                Log_Error._writeErrorFile(error, ex);
                return(null);
            }
            catch (Exception ex)
            {
                error = "Exception ==> Managers_Base --> Base_Total_Payment_Manager --> getTotalPayment() ";
                Log_Error._writeErrorFile(error, ex);
                return(null);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }
示例#4
0
 private void _loadData(Base_Total_Payment bs_class)
 {
     Value_1_TBx.Text = bs_class.Total_payment_name;
 }