예제 #1
0
        private void chkNull(OldBilldetail p)
        {
            long    chk  = 0;
            decimal chk1 = 0;


            p.Name        = p.Name == null ? "" : p.Name;
            p.GroupType   = p.GroupType == null ? "" : p.GroupType;
            p.Comment     = p.Comment == null ? "" : p.Comment;
            p.status      = p.status == null ? "0" : p.status;
            p.date_cancel = p.date_cancel == null ? "" : p.date_cancel;
            p.date_create = p.date_create == null ? "" : p.date_create;
            p.date_modi   = p.date_modi == null ? "" : p.date_modi;
            p.user_cancel = p.user_cancel == null ? "" : p.user_cancel;
            p.user_create = p.user_create == null ? "" : p.user_create;
            p.user_modi   = p.user_modi == null ? "" : p.user_modi;
            p.remark      = p.remark == null ? "" : p.remark;
            p.sort1       = p.sort1 == null ? "" : p.sort1;

            p.bill_id       = long.TryParse(p.bill_id, out chk) ? chk.ToString() : "0";
            p.Extra         = long.TryParse(p.Extra, out chk) ? chk.ToString() : "0";
            p.VN            = long.TryParse(p.VN, out chk) ? chk.ToString() : "0";
            p.item_id       = long.TryParse(p.item_id, out chk) ? chk.ToString() : "0";
            p.pcksid        = long.TryParse(p.pcksid, out chk) ? chk.ToString() : "0";
            p.closeday_id   = long.TryParse(p.closeday_id, out chk) ? chk.ToString() : "0";
            p.bill_group_id = long.TryParse(p.bill_group_id, out chk) ? chk.ToString() : "0";
            p.pckid         = long.TryParse(p.pckid, out chk) ? chk.ToString() : "0";

            p.Price  = decimal.TryParse(p.Price, out chk1) ? chk1.ToString() : "0";
            p.Total  = decimal.TryParse(p.Total, out chk1) ? chk1.ToString() : "0";
            p.price1 = decimal.TryParse(p.price1, out chk1) ? chk1.ToString() : "0";
            p.qty    = decimal.TryParse(p.qty, out chk1) ? chk1.ToString() : "0";
        }
예제 #2
0
        private void initConfig()
        {
            obilld               = new OldBilldetail();
            obilld.ID            = "ID";
            obilld.VN            = "VN";
            obilld.Name          = "Name";
            obilld.Extra         = "Extra";
            obilld.Price         = "Price";
            obilld.Total         = "Total";
            obilld.GroupType     = "GroupType";
            obilld.Comment       = "Comment";
            obilld.item_id       = "item_id";
            obilld.status        = "status";
            obilld.pcksid        = "pcksid";
            obilld.price1        = "price1";
            obilld.qty           = "qty";
            obilld.bill_id       = "bill_id";
            obilld.active        = "active";
            obilld.remark        = "remark";
            obilld.sort1         = "sort1";
            obilld.date_cancel   = "date_cancel";
            obilld.date_create   = "date_create";
            obilld.date_modi     = "date_modi";
            obilld.user_cancel   = "user_cancel";
            obilld.user_create   = "user_create";
            obilld.user_modi     = "user_modi";
            obilld.closeday_id   = "closeday_id";
            obilld.bill_group_id = "bill_group_id";
            obilld.pckid         = "pckid";

            obilld.table   = "BillDetail";
            obilld.pkField = "ID";
        }
예제 #3
0
 private OldBilldetail setBillD(OldBilldetail obilld1)
 {
     obilld1.ID            = "";
     obilld1.VN            = "";
     obilld1.Name          = "";
     obilld1.Extra         = "";
     obilld1.Price         = "";
     obilld1.Total         = "";
     obilld1.GroupType     = "";
     obilld1.Comment       = "";
     obilld1.item_id       = "";
     obilld1.status        = "";
     obilld1.pcksid        = "";
     obilld1.price1        = "";
     obilld1.qty           = "";
     obilld1.bill_id       = "";
     obilld1.active        = "";
     obilld1.remark        = "";
     obilld1.sort1         = "";
     obilld1.date_cancel   = "";
     obilld1.date_create   = "";
     obilld1.date_modi     = "";
     obilld1.user_cancel   = "";
     obilld1.user_create   = "";
     obilld1.user_modi     = "";
     obilld1.closeday_id   = "";
     obilld1.bill_group_id = "";
     obilld1.pckid         = "";
     return(obilld1);
 }
예제 #4
0
        public OldBilldetail selectByPk1(String copId)
        {
            DataTable     dt      = new DataTable();
            OldBilldetail obilld1 = new OldBilldetail();
            String        sql     = "select obilld.* " +
                                    "From " + obilld.table + " obilld " +
                                    "Where obilld." + obilld.pkField + " ='" + copId + "' ";

            dt      = conn.selectData(conn.conn, sql);
            obilld1 = setBillD(dt);
            return(obilld1);
        }
예제 #5
0
        public String insert(OldBilldetail p, String userId)
        {
            String re  = "";
            String sql = "";
            //p.active = "1";
            //p.ssdata_id = "";
            long chk = 0;

            chkNull(p);
            if (userId == null)
            {
                userId = "";
            }
            //lbReq.form_a_id = "form_a_id";
            //p.req_code = genReqDoc();
            sql = "Insert Into " + obilld.table + " Set " +
                  " " + obilld.VN + " = '" + p.VN + "'" +
                  "," + obilld.Name + "= '" + p.Name.Replace("'", "''") + "'" +
                  "," + obilld.Extra + "= '" + p.Extra + "'" +
                  "," + obilld.Price + "= '" + p.Price + "'" +
                  "," + obilld.Total + "= '" + p.Total + "'" +
                  "," + obilld.GroupType + "= '" + p.GroupType + "'" +
                  "," + obilld.Comment + "= '" + p.Comment.Replace("'", "''") + "'" +
                  "," + obilld.item_id + "= '" + p.item_id + "'" +
                  "," + obilld.status + "= '" + p.status + "'" +
                  "," + obilld.pcksid + "= '" + p.pcksid + "'" +
                  "," + obilld.price1 + "= '" + p.price1 + "'" +
                  "," + obilld.qty + "= '" + p.qty + "'" +
                  "," + obilld.date_cancel + "= ''" +
                  "," + obilld.date_create + "= now() " +
                  "," + obilld.date_modi + "= ''" +
                  "," + obilld.user_cancel + "= ''" +
                  "," + obilld.user_create + "= '" + userId + "@" + conn._IPAddress + "'" +
                  "," + obilld.user_modi + "= ''" +
                  "," + obilld.remark + "= '" + p.remark + "'" +
                  "," + obilld.sort1 + "= '" + p.sort1 + "'" +
                  "," + obilld.active + "= '1'" +
                  "," + obilld.bill_id + "= '" + p.bill_id + "'" +
                  "," + obilld.closeday_id + "= '0'" +
                  "," + obilld.bill_group_id + "= '" + p.bill_group_id + "'" +
                  "," + obilld.pckid + "= '" + p.pckid + "'" +
                  "";
            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }

            return(re);
        }
예제 #6
0
        public String insertBillDetail(OldBilldetail p, String userId)
        {
            String re = "";

            if (p.ID.Equals(""))
            {
                re = insert(p, userId);
            }
            else
            {
                //re = update(p, "");
            }
            return(re);
        }
예제 #7
0
        public OldBilldetail setBillD(DataTable dt)
        {
            OldBilldetail obilld1 = new OldBilldetail();

            if (dt.Rows.Count > 0)
            {
                obilld1               = new OldBilldetail();
                obilld1.ID            = dt.Rows[0][obilld.ID].ToString();
                obilld1.VN            = dt.Rows[0][obilld.VN].ToString();
                obilld1.Name          = dt.Rows[0][obilld.Name].ToString();
                obilld1.Extra         = dt.Rows[0][obilld.Extra].ToString();
                obilld1.Price         = dt.Rows[0][obilld.Price].ToString();
                obilld1.Total         = dt.Rows[0][obilld.Total].ToString();
                obilld1.GroupType     = dt.Rows[0][obilld.GroupType].ToString();
                obilld1.Comment       = dt.Rows[0][obilld.Comment].ToString();
                obilld1.item_id       = dt.Rows[0][obilld.item_id].ToString();
                obilld1.status        = dt.Rows[0][obilld.status].ToString();
                obilld1.pcksid        = dt.Rows[0][obilld.pcksid].ToString();
                obilld1.price1        = dt.Rows[0][obilld.price1].ToString();
                obilld1.qty           = dt.Rows[0][obilld.qty].ToString();
                obilld1.bill_id       = dt.Rows[0][obilld.bill_id].ToString();
                obilld1.active        = dt.Rows[0][obilld.active].ToString();
                obilld1.remark        = dt.Rows[0][obilld.remark].ToString();
                obilld1.sort1         = dt.Rows[0][obilld.sort1].ToString();
                obilld1.date_cancel   = dt.Rows[0][obilld.date_cancel].ToString();
                obilld1.date_create   = dt.Rows[0][obilld.date_create].ToString();
                obilld1.date_modi     = dt.Rows[0][obilld.date_modi].ToString();
                obilld1.user_cancel   = dt.Rows[0][obilld.user_cancel].ToString();
                obilld1.user_create   = dt.Rows[0][obilld.user_create].ToString();
                obilld1.user_modi     = dt.Rows[0][obilld.user_modi].ToString();
                obilld1.closeday_id   = dt.Rows[0][obilld.closeday_id].ToString();
                obilld1.bill_group_id = dt.Rows[0][obilld.bill_group_id].ToString();
                obilld1.pckid         = dt.Rows[0][obilld.pckid].ToString();
            }
            else
            {
                setBillD(obilld1);
            }
            return(obilld1);
        }
예제 #8
0
        public String update(OldBilldetail p, String userId)
        {
            String re  = "";
            String sql = "";

            chkNull(p);

            sql = "Update " + obilld.table + " Set " +
                  " " + obilld.Name + " = '" + p.Name.Replace("'", "''") + "'" +
                  "," + obilld.Extra + " = '" + p.Extra + "'" +
                  "," + obilld.Price + " = '" + p.Price + "'" +
                  "," + obilld.Total + " = '" + p.Total + "'" +
                  "," + obilld.GroupType + " = '" + p.GroupType + "'" +
                  "," + obilld.Comment + " = '" + p.Comment.Replace("'", "''") + "'" +
                  "," + obilld.item_id + " = '" + p.item_id + "'" +
                  "," + obilld.status + " = '" + p.status + "'" +
                  "," + obilld.pcksid + " = '" + p.pcksid + "'" +
                  "," + obilld.price1 + "= '" + p.price1 + "'" +
                  "," + obilld.qty + "= '" + p.qty + "'" +
                  "," + obilld.date_modi + "= now() " +
                  "," + obilld.user_modi + "= '" + userId + "'" +
                  "," + obilld.remark + "= '" + p.remark + "'" +
                  "," + obilld.bill_group_id + "= '" + p.bill_group_id + "'" +
                  "Where " + obilld.pkField + "='" + p.ID + "'"
            ;

            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }

            return(re);
        }