Example #1
0
        public void NewMobileAndMerc(string[] merchantData, string DNETS, string DElavon, string status,
                                     string address, string simnr, string note, string MACAddress, string BoxName, string[] CrD, string[] ClD)
        {
            UpdateInternalLists();

            bool     BDNETS   = false;
            bool     BDElavon = false;
            bool     Bstatus  = true;
            Date     CrDate   = ConvertToDate(CrD);
            Date     ClDate   = ConvertToDate(ClD);
            Merchant merchant = new Merchant(merchantData[0], merchantData[1], merchantData[2], merchantData[3], merchantData[4]);

            if (DNETS == "Forsinket")
            {
                BDNETS = true;
            }
            if (DElavon == "Forsinket")
            {
                BDElavon = true;
            }
            if (status != "Aktiv")
            {
                Bstatus = false;
            }

            Mobilesystem mobile = new Mobilesystem(merchant, CrDate, address, simnr, MACAddress,
                                                   BoxName, Bstatus, BDElavon, BDNETS, note, ClDate);

            mobilesystems.Add(mobile);
            merchants.Add(merchant);

            repo.GetMobileLists(mobilesystems);
            repo.GetMercLists(merchants);
        }
Example #2
0
    public string GetProOriginal(string tprice, string currencymobile)
    {
        string strBestSell = "";

        try
        {
            DataTable            table = new DataTable();
            ProductMainPage_data ds    = new Mobilesystem().MobileforShow("Select top 6 * from v_web_mobile_show_all where type=3 order by Sellingprice");
            table = ds.Tables[0];
            int    num    = table.Rows.Count;
            string id     = "";
            string name   = "";
            string price  = "";
            string img    = "";
            float  rate   = (float)Application["ratepromobi"];
            float  price1 = 1;
            for (int i = 0; i < num; i++)
            {
                id   = table.Rows[i][ProductMainPage_data._id].ToString();
                name = table.Rows[i][ProductMainPage_data._name].ToString() + " " + table.Rows[i][ProductMainPage_data._state].ToString();;
                //price = table.Rows[i][ProductMainPage_data._price].ToString();
                price1 = float.Parse(table.Rows[i][ProductMainPage_data._price].ToString());
                price1 = price1 * rate;
                price  = price1.ToString("N").Split('.')[0];
                if (price.Equals("0"))
                {
                    price = "-";
                }
                img = table.Rows[i][ProductMainPage_data._urlImage].ToString();
                if (img.Length > 0)
                {
                    img = "image/img_pro/" + img;
                }
                else
                {
                    img = "image/common/notimgpro.png";
                }
                strBestSell += "<tr><td width='65'>";
                strBestSell += "<a href='?menu=dp&id=" + id + "'><img src='" + img + "' class='img4' /></a></td><td>";
                strBestSell += "<a href='?menu=dp&id=" + id + "'>" + name + "</a><br />";
                strBestSell += "<span class='txt4'>" + price + " " + currencymobile + "</span></td></tr>";
                if (i + 1 < num)
                {
                    strBestSell += "<tr><td colspan='2' class='line1'></td></tr>";
                }
            }
        }
        catch (Exception ex)
        {
            Console.Write(ex.ToString());
        }
        return(strBestSell);
    }
 private void GetProductMainPage()
 {
     try
     {
         DataSet   ds     = new Mobilesystem().MobileMainpage();
         DataTable table  = ds.Tables[0];
         int       numPro = table.Rows.Count;
         if (numPro > 0)
         {
             GetJustHave(ds.Tables[1]);
             GetBestView(ds.Tables[2]);
             //currentAccess += GetListMessage(ds.Tables[3]);
             //currentAccess = "<marquee scrolldelay='120' width='580' onmouseout='start();' onmouseover='stop();'>" + currentAccess + ", " + currentAccess + "</marquee>";
             strProMain  = "<table cellpadding='0' cellspacing='0' border='0' width='100%' bgcolor='#FFFFFF'>";
             strProMain += "<tr><td width='25%'></td><td width='25%'></td><td width='25%'></td><td width='25%'></td></tr>";
             string id       = "";
             string name     = "";
             string url      = "";
             string price    = "";
             string warranty = "";
             float  rate     = (float)Application["ratepromain"];
             float  price1   = 1;
             string madein   = "";
             string isSpec   = "";
             int    count    = 0;
             for (int i = 0; i < numPro; i++)
             {
                 count++;
                 id   = table.Rows[i][ProductMainPage_data._id].ToString();
                 name = table.Rows[i][ProductMainPage_data._name].ToString() + " " + table.Rows[i][ProductMainPage_data._state].ToString();
                 url  = table.Rows[i][ProductMainPage_data._urlImage].ToString();
                 if (url.Length > 0)
                 {
                     url = "image/img_pro/" + url;
                 }
                 else
                 {
                     url = "image/common/notimgpro.png";
                 }
                 price1   = float.Parse(table.Rows[i][ProductMainPage_data._price].ToString());
                 price1   = price1 * rate;
                 price    = price1.ToString("N").Split('.')[0];
                 warranty = table.Rows[i][ProductMainPage_data._WarrantyMonth].ToString();
                 madein   = table.Rows[i][ProductMainPage_data._shortnote].ToString();
                 isSpec   = table.Rows[i][ProductMainPage_data._isspec].ToString();
                 if (count == 1)
                 {
                     strProMain += "<tr align='center' class='txt2' valign='top'>";
                 }
                 strProMain += "<td>";
                 strProMain += "<a href='?menu=dp&id=" + id + "'><img class='img1' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)' src='" + url + "'/></a><span class='txt5'>" + (i + 1) + "</span> <br />";
                 strProMain += "<span class='txt4'>";
                 if (price.Equals("0"))
                 {
                     strProMain += tupdate + "</span><br />";
                 }
                 else
                 {
                     strProMain += price + " " + unitPrice + "</span><br />";
                 }
                 //strProMain += twarranty + ": <span class='txt4'>" + warranty + " " + tmonth + "</span><br />";
                 strProMain += "<a href='?menu=dp&id=" + id + "' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)'>" + name + "</a><br />";
                 if (table.Rows[i][ProductMainPage_data._ispromotion].ToString().Length > 0)
                 {
                     strProMain += "<img src='image/common/khuyenmai.gif' style='cursor:pointer;' onmouseover='showDivMessage(2," + id + "," + i + ",event);' onmouseout='OnMOut(event)'/><br />";
                 }
                 strProMain += "</td>";
                 if (count == 4)
                 {
                     strProMain += "</tr>";
                     if (i + 1 < numPro)
                     {
                         strProMain += "<tr><td colspan='4' class='line1'></td></tr>";
                     }
                     count = 0;
                 }
                 else
                 {
                     if (i + 1 == numPro)
                     {
                         strProMain += "</tr>";
                     }
                 }
             }
             strProMain += "</table>";
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex.ToString());
         strProMain = "";
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string menu      = Request.QueryString["menu"].ToString();
            string strmobile = "";
            switch (menu)
            {
            case ("imgpro"):
            {
                try
                {
                    string id      = Request.QueryString["id"].ToString();
                    string name    = Request.QueryString["name"].ToString();
                    string namepro = Request.QueryString["namepro"].ToString();
                    string subName = "";
                    int    leng    = namepro.Length;
                    for (int i = 0; i < leng; i++)
                    {
                        if (namepro[i].Equals('('))
                        {
                            break;
                        }
                        if (!namepro[i].Equals(','))
                        {
                            subName += namepro[i];
                        }
                    }
                    subName = subName.Trim();
                    Session["SSIdProUpload"] = id + "," + name + "," + subName;
                }
                catch
                {
                }
                Response.Write("ok");
                break;
            }

            case ("bestsell"):
            {
                string strreturn = "";
                try
                {
                    string type = Request.QueryString["type"].ToString();
                    string id   = Request.QueryString["id"].ToString();
                    ProductBestSellSystem products = new ProductBestSellSystem();
                    Boolean test = products.ProductBestUpdate(int.Parse(id), int.Parse(type));
                    if (!test)
                    {
                        strreturn = "err";
                    }
                    else
                    {
                        //ProductMainPage_data ds = new ProductBestSellSystem().ProductBestSellAll();
                        //Application["appProductBestsell"] = ds.Tables[ProductMainPage_data._table];
                    }
                }
                catch
                {
                    strreturn = "err";
                }
                Response.Write(strreturn);
            }
            break;

            case ("justhave"):
            {
                string strreturn = "";
                try
                {
                    string type = Request.QueryString["type"].ToString();
                    string id   = Request.QueryString["id"].ToString();
                    ProductBestSellSystem products = new ProductBestSellSystem();
                    Boolean test = products.ProductJustHaveUpdate(int.Parse(id), int.Parse(type));
                    if (!test)
                    {
                        strreturn = "err";
                    }
                    else
                    {
                        //ProductMainPage_data ds = new ProductBestSellSystem().ProductBestSellAll();
                        //Application["appProductBestsell"] = ds.Tables[ProductMainPage_data._table];
                    }
                }
                catch
                {
                    strreturn = "err";
                }
                Response.Write(strreturn);
            }
            break;

            //prepare out:
            case ("prepareout"):
            {
                string PrepareStr = "";
                try
                {
                    string type = Request.QueryString["type"].ToString();
                    string id   = Request.QueryString["id"].ToString();
                    ProductBestSellSystem products = new ProductBestSellSystem();
                    Boolean test = products.ProductPrepareoutUpdate(int.Parse(id), int.Parse(type));
                    if (!test)
                    {
                        PrepareStr = "err";
                    }
                    else
                    {
                        //ProductMainPage_data ds = new ProductBestSellSystem().ProductBestSellAll();
                        //Application["appProductBestsell"] = ds.Tables[ProductMainPage_data._table];
                    }
                }
                catch
                {
                    PrepareStr = "err";
                }
                Response.Write(PrepareStr);
            }
            break;

            //proselloff:
            case ("proselloff"):
            {
                string strselloff = "";
                try
                {
                    string type  = Request.QueryString["type"].ToString();
                    string id    = Request.QueryString["id"].ToString();
                    float  price = float.Parse(Request.QueryString["price"].ToString());
                    ProductBestSellSystem products = new ProductBestSellSystem();
                    Boolean test = products.ProductSelloffUpdate(int.Parse(id), int.Parse(type), price);
                    if (!test)
                    {
                        strselloff = "err";
                    }
                    else
                    {
                        //ProductMainPage_data ds = new ProductBestSellSystem().ProductBestSellAll();
                        //Application["appProductBestsell"] = ds.Tables[ProductMainPage_data._table];
                    }
                }
                catch
                {
                    strselloff = "err";
                }
                Response.Write(strselloff);
            }
            break;

            case ("mainpage"):
                string strmain = "";
                try
                {
                    string type = Request.QueryString["type"].ToString();
                    string id   = Request.QueryString["id"].ToString();
                    string sort = Request.QueryString["sort"].ToString();
                    ProductMainPageSystem products = new ProductMainPageSystem();
                    Boolean test = products.ProductMainpageUpdate(int.Parse(id), int.Parse(type), int.Parse(sort));
                    if (!test)
                    {
                        strmain = "err";
                    }
                }
                catch
                {
                    strmain = "err";
                }
                Response.Write(strmain);
                break;

            case ("original"):
                string stroriginal = "";
                try
                {
                    string type = Request.QueryString["type"].ToString();
                    string id   = Request.QueryString["id"].ToString();
                    string sort = Request.QueryString["sort"].ToString();
                    ProductMainPageSystem products = new ProductMainPageSystem();
                    Boolean test = products.ProductOriginalUpdate(int.Parse(id), int.Parse(type), int.Parse(sort));
                    if (!test)
                    {
                        stroriginal = "err";
                    }
                }
                catch
                {
                    strmain = "err";
                }
                Response.Write(stroriginal);
                break;

            case ("dgroup"):
                string strdelete = "";
                try
                {
                    string id = Request.QueryString["id"].ToString();
                    ArticleManagerSystem Articles = new ArticleManagerSystem();

                    if (Articles.AdminGroupDeleteId(id))
                    {
                        strdelete = "1";
                    }
                    else
                    {
                        strdelete = "0";
                    }
                }catch
                {
                    strdelete = "0";
                }
                Response.Write(strdelete);
                break;

            case ("dgcontact"):
                string strdcontact = "";
                try
                {
                    string         id       = Request.QueryString["id"].ToString();
                    ContacstSystem Contacts = new ContacstSystem();

                    if (Contacts.GroupContactDeleteId(id))
                    {
                        strdcontact = "1";
                    }
                    else
                    {
                        strdcontact = "0";
                    }
                }
                catch
                {
                    strdcontact = "0";
                }
                Response.Write(strdcontact);
                break;

            case ("dglocation"):
                string strdlocation = "";
                try
                {
                    string         id       = Request.QueryString["id"].ToString();
                    ContacstSystem Contacts = new ContacstSystem();

                    if (Contacts.LocationContactDelete(id))
                    {
                        strdlocation = "1";
                    }
                    else
                    {
                        strdlocation = "0";
                    }
                }
                catch
                {
                    strdlocation = "0";
                }
                Response.Write(strdlocation);
                break;

            case ("dhelp"):
                string strdhelp = "0";
                try
                {
                    string      id    = Request.QueryString["id"].ToString();
                    HelpsSystem helps = new HelpsSystem();

                    if (helps.HelpsDelete(id))
                    {
                        strdhelp = "1";
                    }
                }
                catch
                {
                    strdhelp = "0";
                }
                Response.Write(strdhelp);
                break;

            case ("donline"):
                string stronline = "0";
                try
                {
                    string id = Request.QueryString["id"].ToString();
                    SupportOnlineSystem Support = new SupportOnlineSystem();
                    if (Support.OnlineDelete(id))
                    {
                        stronline = "1";
                        Application["appOnline"] = null;
                    }
                }
                catch
                {
                    stronline = "0";
                }
                Response.Write(stronline);
                break;

            case ("dadvertise"):
                string strdadvertise = "0";
                try
                {
                    string          id        = Request.QueryString["id"].ToString();
                    AdvertiseSystem advertise = new AdvertiseSystem();
                    DataSet         ds        = advertise.AdvertiseSelectId(id);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        string url1 = ds.Tables[0].Rows[0]["urlimage"].ToString();
                        string path = Server.MapPath("../image/advertise/");
                        CvalidateImageForPost manageImage = new CvalidateImageForPost();
                        if (url1.Length > 0)
                        {
                            manageImage.DeleteFile(path + url1);
                        }
                    }
                    if (advertise.AdvertiseDelete(id))
                    {
                        strdadvertise = "1";
                        Application["appAdvertiset"] = null;
                    }
                }
                catch
                {
                    strdadvertise = "0";
                }
                Response.Write(strdadvertise);
                break;

            case ("dadvertisespecial"):
                string strspecial = "0";
                try
                {
                    string          id        = Request.QueryString["id"].ToString();
                    AdvertiseSystem advertise = new AdvertiseSystem();
                    DataSet         ds        = advertise.SpecialSelectId(int.Parse(id));
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        string url1 = ds.Tables[0].Rows[0]["urlimage1"].ToString();
                        string url2 = ds.Tables[0].Rows[0]["urlimage2"].ToString();
                        string path = Server.MapPath("../image/advertise/");
                        CvalidateImageForPost manageImage = new CvalidateImageForPost();
                        if (url1.Length > 0)
                        {
                            manageImage.DeleteFile(path + url1);
                        }
                        if (url2.Length > 0)
                        {
                            manageImage.DeleteFile(path + url2);
                        }
                    }
                    if (advertise.SpecialDelete(id))
                    {
                        strspecial = "1";
                    }
                }
                catch
                {
                    strspecial = "0";
                }
                Response.Write(strspecial);
                break;

            case "darticle":
                string strdarticle = "0";
                try
                {
                    string id = Request.QueryString["id"].ToString();
                    ArticleManagerSystem article = new ArticleManagerSystem();
                    DataSet ds = article.ArticleSelectDetail(int.Parse(id));
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        string url1 = ds.Tables[0].Rows[0]["urlimage"].ToString();
                        string path = Server.MapPath("../image/img_article/");
                        CvalidateImageForPost manageImage = new CvalidateImageForPost();
                        if (url1.Length > 0)
                        {
                            manageImage.DeleteFile(path + url1);
                        }
                    }
                    if (article.AdminArticleDelete(id))
                    {
                        strdarticle = "1";
                    }
                }
                catch
                {
                    strdarticle = "0";
                }
                Response.Write(strdarticle);
                break;

            //for mobile:
            case "mobile1":
                try
                {
                    string       type   = Request.QueryString["type"].ToString();
                    string       id     = Request.QueryString["id"].ToString();
                    string       sort   = Request.QueryString["sort"].ToString();
                    string       insert = Request.QueryString["insert"].ToString();
                    Mobilesystem Mobile = new Mobilesystem();
                    Boolean      test   = Mobile.MobileUpdate(int.Parse(id), int.Parse(insert), int.Parse(type), int.Parse(sort));
                    if (!test)
                    {
                        strmobile = "err";
                    }
                }
                catch
                {
                    strmobile = "err";
                }
                Response.Write(strmobile);
                break;
            }
        }
        catch
        {
        }
    }
Example #5
0
        public void ImportBackup()
        {
            string path  = Path.Combine(Environment.CurrentDirectory, backup);
            int    sheet = 0;

            Excel.Application xlApp = new Excel.Application();
            xlApp.DisplayAlerts = false;

            Excel.Workbook xlWB;

            object misValue = Missing.Value;

            xlWB = xlApp.Workbooks.Open(path);


            foreach (Excel.Worksheet xlWS in xlWB.Worksheets)
            {
                if (sheet == 0) // if it is merchant sheet
                {
                    for (int y = 2; y <= xlWS.UsedRange.Rows.Count; y++)
                    {
                        Merchant merc = new Merchant
                                        (
                            xlWS.Cells[y, 1].Text,
                            xlWS.Cells[y, 2].Text,
                            xlWS.Cells[y, 3].Text,
                            xlWS.Cells[y, 4].Text,
                            xlWS.Cells[y, 5].Text
                                        );

                        merchants.Add(merc);
                    }
                    sheet++;
                }
                else if (sheet == 1) // if it is cardsystem sheet
                {
                    for (int y = 2; y <= xlWS.UsedRange.Rows.Count; y++)
                    {
                        Merchant merc        = null;
                        bool     status      = true;
                        bool     delayCPI    = false;
                        bool     delayEvalon = false;
                        Date     crd         = new Date(int.Parse(xlWS.Cells[y, 9].Text.Split('-')[0]), int.Parse(xlWS.Cells[y, 9].Text.Split('-')[1]), int.Parse(xlWS.Cells[y, 9].Text.Split('-')[2]), "Opretelses Dato");
                        Date     cld         = new Date(int.Parse(xlWS.Cells[y, 10].Text.Split('-')[0]), int.Parse(xlWS.Cells[y, 10].Text.Split('-')[1]), int.Parse(xlWS.Cells[y, 10].Text.Split('-')[2]), "Luknings Dato");

                        foreach (Merchant merchant in merchants)
                        {
                            if (merchant.ID == xlWS.Cells[y, 1].Text)
                            {
                                merc = merchant;
                                break;
                            }
                        }

                        if (xlWS.Cells[y, 2].Text != "Aktiv")
                        {
                            status = false;
                        }

                        if (xlWS.Cells[y, 3].Text == "Forsinket")
                        {
                            delayEvalon = true;
                        }
                        if (xlWS.Cells[y, 4].Text == "Forsinket")
                        {
                            delayCPI = true;
                        }

                        Cardsystem card = new Cardsystem
                                          (
                            merc,
                            crd,
                            xlWS.Cells[y, 5].Text,
                            xlWS.Cells[y, 6].Text,
                            xlWS.Cells[y, 7].Text,
                            xlWS.Cells[y, 8].Text,
                            status,
                            delayEvalon,
                            delayCPI,
                            xlWS.Cells[y, 11].Text,
                            cld
                                          );

                        cardsystems.Add(card);
                    }

                    sheet++;
                }
                else if (sheet == 2) // if it is mobilsystem sheet
                {
                    for (int y = 2; y <= xlWS.UsedRange.Rows.Count; y++)
                    {
                        Merchant merc        = null;
                        bool     status      = true;
                        bool     delayNETS   = false;
                        bool     delayEvalon = false;
                        Date     crd         = new Date(int.Parse(xlWS.Cells[y, 9].Text.Split('-')[0]), int.Parse(xlWS.Cells[y, 9].Text.Split('-')[1]), int.Parse(xlWS.Cells[y, 9].Text.Split('-')[2]), "Opretelses Dato");
                        Date     cld         = new Date(int.Parse(xlWS.Cells[y, 10].Text.Split('-')[0]), int.Parse(xlWS.Cells[y, 10].Text.Split('-')[1]), int.Parse(xlWS.Cells[y, 10].Text.Split('-')[2]), "Luknings Dato");

                        foreach (Merchant merchant in merchants)
                        {
                            if (merchant.ID == xlWS.Cells[y, 1].Text)
                            {
                                merc = merchant;
                                break;
                            }
                        }

                        if (xlWS.Cells[y, 2].Text != "Aktiv")
                        {
                            status = false;
                        }

                        if (xlWS.Cells[y, 3].Text == "Forsinket")
                        {
                            delayEvalon = true;
                        }
                        if (xlWS.Cells[y, 4].Text == "Forsinket")
                        {
                            delayNETS = true;
                        }

                        Mobilesystem mobile = new Mobilesystem
                                              (
                            merc,
                            crd,
                            xlWS.Cells[y, 5].Text,
                            xlWS.Cells[y, 6].Text,
                            xlWS.Cells[y, 7].Text,
                            xlWS.Cells[y, 8].Text,
                            status,
                            delayEvalon,
                            delayNETS,
                            xlWS.Cells[y, 11].Text,
                            cld
                                              );

                        mobilesystems.Add(mobile);
                    }

                    sheet++;
                }
            }

            repo.GetCardLists(cardsystems);
            repo.GetMobileLists(mobilesystems);
            repo.GetMercLists(merchants);
        }