Beispiel #1
0
        public String insert(ExpensesPay p, String userId)
        {
            String re = "", sql = "";

            p.active = "1";
            //p.ssdata_id = "";
            chkNull(p);
            sql = "Insert Into " + expnP.table + "(" + expnP.expenses_pay_code + "," + expnP.expenses_pay_date + "," + expnP.status_pay_type + "," +
                  expnP.active + "," + expnP.remark + ", " +
                  expnP.date_create + ", " + expnP.date_modi + ", " + expnP.date_cancel + ", " +
                  expnP.user_create + ", " + expnP.user_modi + ", " + expnP.user_cancel + " " +
                  ") " +
                  "Values ('" + p.expenses_pay_code + "','" + p.expenses_pay_date + "','" + p.status_pay_type + "'," +
                  "'" + p.active + "','" + p.remark + "',  " +
                  "now(),'" + p.date_modi + "','" + p.date_cancel + "', " +
                  "'" + userId + "','" + p.user_modi + "','" + p.user_cancel + "' " +
                  ")";

            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }
            return(re);
        }
Beispiel #2
0
        public C1ComboBox setC1CboItem(C1ComboBox c)
        {
            lexpn.Clear();
            ComboBoxItem item = new ComboBoxItem();
            DataTable    dt   = selectAll();
            //String aaa = "";
            ComboBoxItem item1 = new ComboBoxItem();

            item1.Text  = "";
            item1.Value = "000";
            c.Items.Clear();
            c.Items.Add(item1);
            //for (int i = 0; i < dt.Rows.Count; i++)
            foreach (DataRow row in dt.Rows)
            {
                item       = new ComboBoxItem();
                item.Text  = row[expnP.expenses_pay_date].ToString();
                item.Value = row[expnP.expenses_pay_id].ToString();
                c.Items.Add(item);

                ExpensesPay expn1 = new ExpensesPay();
                expn1.expenses_pay_id   = row[expnP.expenses_pay_id].ToString();
                expn1.expenses_pay_code = row[expnP.expenses_pay_code].ToString();
                expn1.status_pay_type   = row[expnP.status_pay_type].ToString();
                expn1.expenses_pay_date = row[expnP.expenses_pay_date].ToString();

                lexpn.Add(expn1);
            }
            return(c);
        }
Beispiel #3
0
        public String update(ExpensesPay p, String userId)
        {
            String re = "", sql = "";

            chkNull(p);
            sql = "Update " + expnP.table + " Set " +
                  " " + expnP.expenses_pay_code + "='" + p.expenses_pay_code + "' " +
                  "," + expnP.status_pay_type + "='" + p.status_pay_type.Replace("'", "''") + "' " +
                  "," + expnP.expenses_pay_date + "='" + p.expenses_pay_date.Replace("'", "''") + "' " +
                  "," + expnP.remark + "='" + p.remark.Replace("'", "''") + "' " +
                  "," + expnP.date_modi + "=now() " +
                  "," + expnP.user_modi + "='" + userId.Replace("'", "''") + "' " +
                  "Where " + expnP.expenses_pay_id + "='" + p.expenses_pay_id + "'"
            ;

            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }
            return(re);
        }
Beispiel #4
0
        public String insertExpensesPay(ExpensesPay p, String userId)
        {
            String re = "";

            if (p.expenses_pay_id.Equals(""))
            {
                re = insert(p, userId);
            }
            else
            {
                re = update(p, userId);
            }
            return(re);
        }
Beispiel #5
0
        private void chkNull(ExpensesPay p)
        {
            int     chk  = 0;
            Decimal chk1 = 0;

            p.date_modi   = p.date_modi == null ? "" : p.date_modi;
            p.date_cancel = p.date_cancel == null ? "" : p.date_cancel;
            p.user_create = p.user_create == null ? "" : p.user_create;
            p.user_modi   = p.user_modi == null ? "" : p.user_modi;
            p.user_cancel = p.user_cancel == null ? "" : p.user_cancel;

            p.expenses_pay_code = p.expenses_pay_code == null ? "" : p.expenses_pay_code;
            p.expenses_pay_date = p.expenses_pay_date == null ? "" : p.expenses_pay_date;
            p.status_pay_type   = p.status_pay_type == null ? "" : p.status_pay_type;
            p.remark            = p.remark == null ? "" : p.remark;


            //p.amount_reserve = Decimal.TryParse(p.amount_reserve, out chk1) ? chk1.ToString() : "0";
        }
Beispiel #6
0
        private void initConfig()
        {
            expnP = new ExpensesPay();
            expnP.expenses_pay_id   = "expenses_pay_id";
            expnP.expenses_pay_code = "expenses_pay_code";
            expnP.expenses_pay_date = "expenses_pay_date";
            expnP.status_pay_type   = "status_pay_type";
            expnP.active            = "active";
            expnP.remark            = "remark";
            expnP.user_cancel       = "user_cancel";
            expnP.user_create       = "user_create";
            expnP.user_modi         = "user_modi";
            expnP.date_cancel       = "date_cancel";
            expnP.date_create       = "date_create";
            expnP.date_modi         = "date_modi";

            expnP.table   = "t_expenses_pay";
            expnP.pkField = "expenses_pay_id";

            lexpn = new List <ExpensesPay>();
        }