Пример #1
0
        private void initConfig()
        {
            ugw                = new UnitGw();
            ugw.unit_gw_id     = "unit_gw_id";
            ugw.unit_gw_code   = "unit_gw_code";
            ugw.unit_gw_name_e = "unit_gw_name_e";
            ugw.unit_gw_name_t = "unit_gw_name_t";
            //tmn.status_app = "status_app";
            ugw.sort1 = "sort1";

            ugw.active      = "active";
            ugw.date_create = "date_create";
            ugw.date_modi   = "date_modi";
            ugw.date_cancel = "date_cancel";
            ugw.user_create = "user_create";
            ugw.user_modi   = "user_modi";
            ugw.user_cancel = "user_cancel";
            //tmn.status_app = "status_app";
            ugw.remark = "remark";

            ugw.table   = "b_unit_gw";
            ugw.pkField = "unit_gw_id";

            lUgw = new List <UnitGw>();
            //getlUgw();
        }
Пример #2
0
        public String update(UnitGw 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 " + ugw.table + " Set " +
                  " " + ugw.unit_gw_code + " = '" + p.unit_gw_code + "'" +
                  "," + ugw.unit_gw_name_e + " = '" + p.unit_gw_name_e.Replace("'", "''") + "'" +
                  "," + ugw.unit_gw_name_t + " = '" + p.unit_gw_name_t.Replace("'", "''") + "'" +
                  "," + ugw.remark + " = '" + p.remark.Replace("'", "''") + "'" +
                  "," + ugw.date_modi + " = now()" +
                  "," + ugw.user_modi + " = '" + p.user_modi + "' " +
                  "," + ugw.sort1 + " = '" + p.sort1 + "' " +
                  //"," + tmn.status_app + " = '" + p.status_app + "' " +
                  "Where " + ugw.pkField + "='" + p.unit_gw_id + "'"
            ;

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

            return(re);
        }
Пример #3
0
        public UnitGw selectByPk1(String copId)
        {
            UnitGw    cop1 = new UnitGw();
            DataTable dt   = new DataTable();
            String    sql  = "select ugw.* " +
                             "From " + ugw.table + " ugw " +
                             //"Left Join t_ssdata_visit ssv On ssv.ssdata_visit_id = bd.ssdata_visit_id " +
                             "Where ugw." + ugw.pkField + " ='" + copId + "' ";

            dt   = conn.selectData(conn.conn, sql);
            cop1 = setUnitGw(dt);
            return(cop1);
        }
Пример #4
0
        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])\])$");
        }
Пример #5
0
        public String insertUnitGw(UnitGw p)
        {
            String re = "";

            if (p.unit_gw_id.Equals(""))
            {
                re = insert(p);
            }
            else
            {
                re = update(p);
            }

            return(re);
        }
Пример #6
0
        public void getlUgw()
        {
            //lDept = new List<Department>();

            lUgw.Clear();
            DataTable dt = new DataTable();

            dt    = selectAll();
            dtUgw = dt;
            foreach (DataRow row in dt.Rows)
            {
                UnitGw utp1 = new UnitGw();
                utp1.unit_gw_id     = row[ugw.unit_gw_id].ToString();
                utp1.unit_gw_code   = row[ugw.unit_gw_code].ToString();
                utp1.unit_gw_name_e = row[ugw.unit_gw_name_e].ToString();
                utp1.unit_gw_name_t = row[ugw.unit_gw_name_t].ToString();

                lUgw.Add(utp1);
            }
        }
Пример #7
0
        public String insert(UnitGw 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 " + ugw.table + "(" + ugw.unit_gw_code + "," + ugw.unit_gw_name_e + "," + ugw.unit_gw_name_t + "," +
                  ugw.date_create + "," + ugw.date_modi + "," + ugw.date_cancel + "," +
                  ugw.user_create + "," + ugw.user_modi + "," + ugw.user_cancel + "," +
                  ugw.active + "," + ugw.remark + ", " + ugw.sort1 + " " +
                  ") " +
                  "Values ('" + p.unit_gw_code + "','" + p.unit_gw_name_e.Replace("'", "''") + "','" + p.unit_gw_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);
        }
Пример #8
0
        private UnitGw setUnitGw(DataTable dt)
        {
            UnitGw pti1 = new UnitGw();

            if (dt.Rows.Count > 0)
            {
                pti1.unit_gw_id     = dt.Rows[0][ugw.unit_gw_id].ToString();
                pti1.unit_gw_code   = dt.Rows[0][ugw.unit_gw_code].ToString();
                pti1.unit_gw_name_e = dt.Rows[0][ugw.unit_gw_name_e].ToString();
                pti1.unit_gw_name_t = dt.Rows[0][ugw.unit_gw_name_t].ToString();
                pti1.active         = dt.Rows[0][ugw.active].ToString();
                pti1.date_cancel    = dt.Rows[0][ugw.date_cancel].ToString();
                pti1.date_create    = dt.Rows[0][ugw.date_create].ToString();
                pti1.date_modi      = dt.Rows[0][ugw.date_modi].ToString();
                pti1.user_cancel    = dt.Rows[0][ugw.user_cancel].ToString();
                pti1.user_create    = dt.Rows[0][ugw.user_create].ToString();
                pti1.user_modi      = dt.Rows[0][ugw.user_modi].ToString();
                //pti1.status_app = dt.Rows[0][tmn.status_app].ToString();
                pti1.remark = dt.Rows[0][ugw.remark].ToString();
                pti1.sort1  = dt.Rows[0][ugw.sort1].ToString();
            }

            return(pti1);
        }