private void initConfig() { utp = new UnitPackage(); utp.unit_package_id = "unit_package_id"; utp.unit_package_code = "unit_package_code"; utp.unit_package_name_e = "unit_package_name_e"; utp.unit_package_name_t = "unit_package_name_t"; //tmn.status_app = "status_app"; utp.sort1 = "sort1"; utp.active = "active"; utp.date_create = "date_create"; utp.date_modi = "date_modi"; utp.date_cancel = "date_cancel"; utp.user_create = "user_create"; utp.user_modi = "user_modi"; utp.user_cancel = "user_cancel"; //tmn.status_app = "status_app"; utp.remark = "remark"; utp.table = "b_unit_package"; utp.pkField = "unit_package_id"; lUtp = new List <UnitPackage>(); //getlPol(); }
public String update(UnitPackage p) { String re = ""; String sql = ""; int chk = 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; sql = "Update " + utp.table + " Set " + " " + utp.unit_package_code + " = '" + p.unit_package_code + "'" + "," + utp.unit_package_name_e + " = '" + p.unit_package_name_e.Replace("'", "''") + "'" + "," + utp.unit_package_name_t + " = '" + p.unit_package_name_t.Replace("'", "''") + "'" + "," + utp.remark + " = '" + p.remark.Replace("'", "''") + "'" + "," + utp.date_modi + " = now()" + "," + utp.user_modi + " = '" + p.user_modi + "' " + "," + utp.sort1 + " = '" + p.sort1 + "' " + //"," + tmn.status_app + " = '" + p.status_app + "' " + "Where " + utp.pkField + "='" + p.unit_package_id + "'" ; try { re = conn.ExecuteNonQuery(conn.conn, sql); } catch (Exception ex) { sql = ex.Message + " " + ex.InnerException; } return(re); }
public UnitPackage selectByPk1(String copId) { UnitPackage cop1 = new UnitPackage(); DataTable dt = new DataTable(); String sql = "select utp.* " + "From " + utp.table + " utp " + //"Left Join t_ssdata_visit ssv On ssv.ssdata_visit_id = bd.ssdata_visit_id " + "Where utp." + utp.pkField + " ='" + copId + "' "; dt = conn.selectData(conn.conn, sql); cop1 = setPortImport(dt); return(cop1); }
private void initConfig() { String appName = ""; appName = System.AppDomain.CurrentDomain.FriendlyName; appName = appName.ToLower().Replace(".exe", ""); if (System.IO.File.Exists(Environment.CurrentDirectory + "\\" + appName + ".ini")) { appName = Environment.CurrentDirectory + "\\" + appName + ".ini"; } else { appName = Environment.CurrentDirectory + "\\" + Application.ProductName + ".ini"; } iniF = new IniFile(appName); iniC = new InitConfig(); user = new Staff(); GetConfig(); conn = new ConnectDB(iniC); xtDB = new XtrimDB(conn); sCus = new Customer(); sImp = new Customer(); sFwd = new Customer(); sEtt = new EntryType(); sPol = new PortOfLoading(); sPvl = new Privilege(); sUgw = new UnitGw(); sUtp = new UnitPackage(); sTmn = new Terminal(); sSoap = new StringSOAP(); sStf = new Staff(); sCot = new Country(); sPti = new PortImport(); sIct = new IncoTerms(); sTpm = new TermPayment(); sInsr = new Customer(); sCurr = new Currency(); sTrkCop = new Customer(); sAddr = new Address(); sConY = new Customer(); sItm = new Items(); sEcc = new ExpensesClearCash(); ftpC = new FtpClient(iniC.hostFTP, iniC.userFTP, iniC.passFTP); cTxtFocus = ColorTranslator.FromHtml(iniC.txtFocus); regEmail = new Regex(@"^([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])$"); }
public String insertPortImprt(UnitPackage p) { String re = ""; if (p.unit_package_id.Equals("")) { re = insert(p); } else { re = update(p); } return(re); }
public static UnitPackageAggregate ToDomain(this UnitPackage unitPackage) { if (unitPackage == null) { throw new ArgumentNullException(nameof(unitPackage)); } return(new UnitPackageAggregate { CategoryName = unitPackage.Category == null ? null : unitPackage.Category.Name, Library = unitPackage.Library, Version = unitPackage.Version, Parameters = string.IsNullOrWhiteSpace(unitPackage.Parameters) ? new string[0] : unitPackage.Parameters.Split(',') }); }
public void getlPol() { //lDept = new List<Department>(); lUtp.Clear(); DataTable dt = new DataTable(); dt = selectAll(); dtUtp = dt; foreach (DataRow row in dt.Rows) { UnitPackage utp1 = new UnitPackage(); utp1.unit_package_id = row[utp.unit_package_id].ToString(); utp1.unit_package_code = row[utp.unit_package_code].ToString(); utp1.unit_package_name_e = row[utp.unit_package_name_e].ToString(); utp1.unit_package_name_t = row[utp.unit_package_name_t].ToString(); lUtp.Add(utp1); } }
public String insert(UnitPackage p) { String re = ""; String sql = ""; p.active = "1"; //p.ssdata_id = ""; int chk = 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.prefix_id = int.TryParse(p.prefix_id, out chk) ? chk.ToString() : "0"; //p.dept_id = int.TryParse(p.dept_id, out chk) ? chk.ToString() : "0"; sql = "Insert Into " + utp.table + "(" + utp.unit_package_code + "," + utp.unit_package_name_e + "," + utp.unit_package_name_t + "," + utp.date_create + "," + utp.date_modi + "," + utp.date_cancel + "," + utp.user_create + "," + utp.user_modi + "," + utp.user_cancel + "," + utp.active + "," + utp.remark + ", " + utp.sort1 + " " + ") " + "Values ('" + p.unit_package_code + "','" + p.unit_package_name_e.Replace("'", "''") + "','" + p.unit_package_name_t.Replace("'", "''") + "'," + "'" + p.date_create + "','" + p.date_modi + "','" + p.date_cancel + "'," + "'" + p.user_create + "','" + p.user_modi + "','" + p.user_cancel + "'," + "'" + p.active + "','" + p.remark.Replace("'", "''") + "','" + p.sort1 + "' " + ")"; try { re = conn.ExecuteNonQuery(conn.conn, sql); } catch (Exception ex) { sql = ex.Message + " " + ex.InnerException; } return(re); }
private UnitPackage setPortImport(DataTable dt) { UnitPackage pti1 = new UnitPackage(); if (dt.Rows.Count > 0) { pti1.unit_package_id = dt.Rows[0][utp.unit_package_id].ToString(); pti1.unit_package_code = dt.Rows[0][utp.unit_package_code].ToString(); pti1.unit_package_name_e = dt.Rows[0][utp.unit_package_name_e].ToString(); pti1.unit_package_name_t = dt.Rows[0][utp.unit_package_name_t].ToString(); pti1.active = dt.Rows[0][utp.active].ToString(); pti1.date_cancel = dt.Rows[0][utp.date_cancel].ToString(); pti1.date_create = dt.Rows[0][utp.date_create].ToString(); pti1.date_modi = dt.Rows[0][utp.date_modi].ToString(); pti1.user_cancel = dt.Rows[0][utp.user_cancel].ToString(); pti1.user_create = dt.Rows[0][utp.user_create].ToString(); pti1.user_modi = dt.Rows[0][utp.user_modi].ToString(); //pti1.status_app = dt.Rows[0][tmn.status_app].ToString(); pti1.remark = dt.Rows[0][utp.remark].ToString(); pti1.sort1 = dt.Rows[0][utp.sort1].ToString(); } return(pti1); }