Beispiel #1
0
 public StoreInformation(StoreHost host)
 {
     this.PrinterIP = host.PrinterIP;
     this.RouterIP = host.RouterIP;
     this.LaptopIP1 = host.LaptopIP1;
     this.LaptopIP2 = host.LaptopIP2;
     this.FingerIP = host.FingerIP;
     this.FlowIP = host.FlowIP;
 }
Beispiel #2
0
 public StoreInformation(StoreHost host)
 {
     this.PrinterIP = host.PrinterIP;
     this.RouterIP  = host.RouterIP;
     this.LaptopIP1 = host.LaptopIP1;
     this.LaptopIP2 = host.LaptopIP2;
     this.FingerIP  = host.FingerIP;
     this.FlowIP    = host.FlowIP;
 }
Beispiel #3
0
        public static StoreHost GetStoreHost(string storeNo)
        {
            StoreHost host = new StoreHost();
            string    url  = "http://10.1" + storeNo.Substring(0, 2) + "." + Convert.ToInt32(storeNo.Substring(2, 2)).ToString();

            host.Url       = url + ".100";
            host.PrinterIP = host.Url.Substring(7);
            host.RouterIP  = (url + ".1").Substring(7);
            host.LaptopIP1 = (url + ".40").Substring(7) + ";" + (url + ".41").Substring(7);
            host.LaptopIP2 = (url + ".50").Substring(7) + ";" + (url + ".51").Substring(7);
            host.FingerIP  = (url + ".140").Substring(7);
            host.FlowIP    = (url + ".120").Substring(7);

            return(host);
        }
Beispiel #4
0
        public static void InsertStoreInformationTemp()
        {
            DataSet ds = SqlHelper.GetOpeningStores();
            List <StoreInformation> list = new List <StoreInformation>();
            int count = ds.Tables[0].Rows.Count;

            for (int i = 0; i < count; i++)
            {
                string           storeNo = ds.Tables[0].Rows[i][0].ToString();
                StoreHost        host    = Common.GetStoreHost(storeNo);
                StoreInformation store   = new StoreInformation(host);
                store.StoreNo     = storeNo;
                store.StoreRegion = ds.Tables[0].Rows[i][1].ToString();
                store.StoreType   = ds.Tables[0].Rows[i][2].ToString();
                list.Add(store);
            }

            string[]  clist = { "storeNo", "storeRegion", "storeType", "printerIP", "routerIP", "laptopIP1", "laptopIP2", "fingerIP", "flowIP", "emailAddress", "printerType", "tonerType", "routerType" };
            DataTable dt    = new DataTable();

            foreach (string colname in clist)
            {
                dt.Columns.Add(colname);
            }
            int rowcount = list.Count;

            for (int i = 0; i < rowcount; i++)
            {
                DataRow row = dt.NewRow();
                row["storeNo"]      = list[i].StoreNo;
                row["storeRegion"]  = list[i].StoreRegion;
                row["storeType"]    = list[i].StoreType;
                row["printerIP"]    = list[i].PrinterIP;
                row["routerIP"]     = list[i].RouterIP;
                row["laptopIP1"]    = list[i].LaptopIP1;
                row["laptopIP2"]    = list[i].LaptopIP2;
                row["fingerIP"]     = list[i].FingerIP;
                row["flowIP"]       = list[i].FlowIP;
                row["emailAddress"] = list[i].StoreNo + "*****@*****.**"; // [email protected]
                row["printerType"]  = null;
                row["tonerType"]    = null;
                row["routerType"]   = null;
                dt.Rows.Add(row);
            }
            SqlHelper.TruncateStoreInformationTemp();
            SqlHelper.CommonBulkInsert(dt, "StoreInformationTemp");
        }
Beispiel #5
0
        public static StoreHost GetStoreHost(string storeNo)
        {
            StoreHost host = new StoreHost();
            string url = "http://10.1" + storeNo.Substring(0, 2) + "." + Convert.ToInt32(storeNo.Substring(2, 2)).ToString();
            host.Url = url + ".100";
            host.PrinterIP = host.Url.Substring(7);
            host.RouterIP = (url + ".1").Substring(7);
            host.LaptopIP1 = (url + ".40").Substring(7) + ";" + (url + ".41").Substring(7);
            host.LaptopIP2 = (url + ".50").Substring(7) + ";" + (url + ".51").Substring(7);
            host.FingerIP = (url + ".140").Substring(7);
            host.FlowIP = (url + ".120").Substring(7);

            return host;
        }