private void chkNull(OldJobPxDetail p) { long chk = 0; decimal chk1 = 0; p.PIDS = p.PIDS == null ? "" : p.PIDS; p.DUName = p.DUName == null ? "" : p.DUName; p.Comment = p.Comment == null ? "NULL" : p.Comment; p.TUsage = p.TUsage == null ? "" : p.TUsage; p.EUsage = p.EUsage == null ? "" : p.EUsage; p.Comment = p.Comment.Equals("")? "NULL" : p.Comment; p.status_print = p.status_print == null ? "0" : p.status_print; p.status_up_stock = p.status_up_stock == null ? "0" : p.status_up_stock; p.order_date_time = p.order_date_time == null ? "" : p.order_date_time; p.ID = long.TryParse(p.ID, out chk) ? chk.ToString() : "0"; p.VN = long.TryParse(p.VN, out chk) ? chk.ToString() : "0"; p.DUID = long.TryParse(p.DUID, out chk) ? chk.ToString() : "0"; p.QTY = long.TryParse(p.QTY.Replace(".00", ""), out chk) ? chk.ToString() : "0"; p.Extra = long.TryParse(p.Extra, out chk) ? chk.ToString() : "0"; p.Status = long.TryParse(p.Status, out chk) ? chk.ToString() : "0"; p.PID = long.TryParse(p.PID, out chk) ? chk.ToString() : "0"; p.row1 = long.TryParse(p.row1, out chk) ? chk.ToString() : "0"; p.pckdid = long.TryParse(p.pckdid, out chk) ? chk.ToString() : "0"; p.staff_id = long.TryParse(p.staff_id, out chk) ? chk.ToString() : "0"; p.Price = decimal.TryParse(p.Price, out chk1) ? chk1.ToString() : "0"; p.price1 = decimal.TryParse(p.price1, out chk1) ? chk1.ToString() : "0"; }
private void initConfig() { oJpxd = new OldJobPxDetail(); oJpxd.ID = "ID"; oJpxd.VN = "VN"; oJpxd.DUID = "DUID"; oJpxd.QTY = "QTY"; oJpxd.Extra = "Extra"; oJpxd.Price = "Price"; oJpxd.Status = "Status"; oJpxd.PID = "PID"; oJpxd.PIDS = "PIDS"; oJpxd.DUName = "DUName"; oJpxd.Comment = "Comment"; oJpxd.TUsage = "TUsage"; oJpxd.EUsage = "EUsage"; oJpxd.row1 = "row1"; oJpxd.price1 = "price1"; oJpxd.pckdid = "pckdid"; oJpxd.status_print = "status_print"; oJpxd.status_up_stock = "status_up_stock"; oJpxd.pharmacy_finish_date_time = "pharmacy_finish_date_time"; oJpxd.staff_id = "staff_id"; oJpxd.order_date_time = "order_date_time"; oJpxd.table = "JobPxDetail"; oJpxd.pkField = "ID"; }
public String insert(OldJobPxDetail p, String userId) { String re = ""; String sql = ""; p.active = "1"; //p.ssdata_id = ""; int chk = 0; chkNull(p); //lbReq.form_a_id = "form_a_id"; //p.req_code = genReqDoc(); sql = "Insert Into " + oJpxd.table + " Set " + " " + oJpxd.VN + " = '" + p.VN + "'" + "," + oJpxd.DUID + "= '" + p.DUID + "'" + "," + oJpxd.QTY + "= '" + p.QTY + "'" + "," + oJpxd.Extra + "= '" + p.Extra.Replace("'", "''") + "'" + "," + oJpxd.Price + "= '" + p.Price.Replace("'", "''") + "'" + "," + oJpxd.Status + "= '" + p.Status + "'" + "," + oJpxd.PID + "= '" + p.PID + "'" + "," + oJpxd.PIDS + "= '" + p.PIDS + "'" + "," + oJpxd.DUName + "= '" + p.DUName.Replace("'", "''") + "'" + "," + oJpxd.Comment + "= '" + p.Comment.Replace("'", "''") + "'" + "," + oJpxd.TUsage + "= '" + p.TUsage.Replace("'", "''") + "'" + "," + oJpxd.EUsage + "= '" + p.EUsage.Replace("'", "''") + "'" + "," + oJpxd.row1 + "= '" + p.row1 + "'" + "," + oJpxd.price1 + "= '" + p.price1 + "'" + "," + oJpxd.pckdid + "= '" + p.pckdid + "'" + "," + oJpxd.status_print + "= '" + p.status_print + "'" + "," + oJpxd.status_up_stock + "= '" + p.status_up_stock + "'" + "," + oJpxd.staff_id + "= '" + p.staff_id + "'" + "," + oJpxd.order_date_time + "= now() " + ""; try { re = conn.ExecuteNonQuery(conn.conn, sql); } catch (Exception ex) { sql = ex.Message + " " + ex.InnerException; } return(re); }