コード例 #1
0
        private void SaveData()
        {
            DataTable tbl        = this.gridControl1.DataSource as DataTable;
            DataTable tblChanged = tbl.GetChanges();

            if (tblChanged != null)
            {
                foreach (DataRow rowInfo in tblChanged.Rows)
                {
                    long CompanyID = QT.Entities.Common.Obj2Int64(rowInfo["CompanyID"]);

                    productAdapter.InsertRatting(CompanyID);

                    productAdapter.UpdateRattingProduct(
                        QT.Entities.Common.Obj2Int64(rowInfo["CompanyID"]),
                        QT.Entities.Common.Obj2Int(rowInfo["Reputation"]),
                        QT.Entities.Common.Obj2Int(rowInfo["BigStore"]),
                        QT.Entities.Common.Obj2Int(rowInfo["Scandal"]),
                        QT.Entities.Common.Obj2Int(rowInfo["Genuine"]),
                        QT.Entities.Common.Obj2Int(rowInfo["Quanlity"]),
                        QT.Entities.Common.Obj2Int(rowInfo["Attitude"]),
                        QT.Entities.Common.Obj2Int(rowInfo["Delivery"]),
                        QT.Entities.Common.Obj2Int(rowInfo["Guarantee"]),
                        QT.Entities.Common.Obj2Int(rowInfo["Swap"]),
                        QT.Entities.Common.Obj2Int(rowInfo["Price"]),
                        QT.Entities.Common.Obj2Int(rowInfo["OldCustomer"]));

                    LogJobAdapter.SaveLog(JobName.FrmRankingCompany_SaveRanking, "Sửa ratting", CompanyID, (int)JobTypeData.Company);
                }
            }
            tbl.AcceptChanges();
            MessageBox.Show("Đã lưu");
        }
コード例 #2
0
 private void toolTaiCat_Click(object sender, EventArgs e)
 {
     Wait.Show("Đang tải dữ liệu!");
     try
     {
         //this.productTableAdapter.FillBy_CategoryID(this.dBPMan.Product, Common.Obj2Int(this.iDCategoryTextBox.Text.Trim()));
         this.dBPMan.Product.Rows.Clear();
         string cat = string.Format("c{0}_", Common.Obj2Int(this.iDCategoryTextBox.Text.Trim()).ToString("D3"));
         if (checkLoadConfig.Checked)
         {
             this.productTableAdapter.FillBy_SPGoc_LikeContentFTGetByStatusConfig(this.dBPMan.Product, cat);
         }
         else
         {
             this.productTableAdapter.FillBy_SPGoc_LikeContentFT(this.dBPMan.Product, cat);
         }
         this.gridView1.ExpandAllGroups();
         this.xtraTabControl1.SelectedTabPageIndex = 1;
         LogJobAdapter.SaveLog(JobName.FrmManagerProduct_Load_Cat, "Click load Cat nên ko có ID...", 0, (int)JobTypeData.KhongXacDinh);
     }
     catch (Exception)
     {
     }
     Wait.Close();
 }
コード例 #3
0
        private void btDoiCategory_Click(object sender, EventArgs e)
        {
            int cat = Common.Obj2Int(txtCatDoi.Text.Trim());

            if (this.txtNoiDungCat.Text.Trim().Length <= 0)
            {
                Wait.Show("Phải nhập nội dung");
                Wait.Close();
                this.txtNoiDungCat.Focus();
            }
            else if (cat == 0)
            {
                Wait.Show("Phải nhập nội dung");
                Wait.Close();
                this.txtCatDoi.Focus();
            }
            else
            {
                //Check Category tồn tại trong bảng ListClassfication
                // Nếu k tồn tại thì thông báo ra ngoài
                // Nếu tồn tại thì lấy cái
                this.productBindingSource.MoveFirst();
                for (int i = 0; i < this.productBindingSource.Count; i++)
                {
                    if (nameTextBox.Text.IndexOf(txtNoiDungCat.Text.Trim()) >= 0)
                    {
                        this.categoryIDTextBox.Text = cat.ToString();
                        this.contentFTTextEdit.Text = string.Format("c{0}_", cat.ToString("D3"));
                    }
                    this.productBindingSource.MoveNext();
                }
                LogJobAdapter.SaveLog(JobName.FrmEditeTenSanPham_Doi_Category, "Click vào nút đổi category sản phẩm hàng loạt nên ko có ID", 0, (int)JobTypeData.KhongXacDinh);
            }
        }
コード例 #4
0
 private void btThayThe_Click(object sender, EventArgs e)
 {
     if (this.txtNoiDungMuonThay.Text.Trim().Length <= 0)
     {
         Wait.Show("Phải nhập nội dung");
         Wait.Close();
         this.txtNoiDungMuonThay.Focus();
     }
     else if (this.txtNoiDungThayBang.Text.Trim().Length <= 0)
     {
         Wait.Show("Phải nhập nội dung");
         Wait.Close();
         this.txtNoiDungThayBang.Focus();
     }
     else
     {
         this.productBindingSource.MoveFirst();
         for (int i = 0; i < this.productBindingSource.Count; i++)
         {
             this.nameTextBox.Text = this.nameTextBox.Text.Trim().Replace(this.txtNoiDungMuonThay.Text.Trim().ToString(), this.txtNoiDungThayBang.Text.Trim());
             this.productBindingSource.MoveNext();
         }
         LogJobAdapter.SaveLog(JobName.FrmEditeTenSanPham_Noi_dung_thay_the, "Click vào nút thay thế nội dung sản phẩm hàng loạt nên ko có ID", 0, (int)JobTypeData.KhongXacDinh);
     }
 }
コード例 #5
0
        private void ctrProductIdentity1_UpdateProductIdentityClick(SaveStatus saveStatus)
        {
            string a = iDTextBox.Text;
            string b = a;
            string c = b;

            if (saveStatus == SaveStatus.Temporary)
            {
                Save();
                LogJobAdapter.SaveLog(JobName.FrmManagerProduct_LuuTam, "Ấn nút lưu tạm", Common.Obj2Int64(iDTextBox.Text), (int)JobTypeData.Product);
            }
            if (saveStatus == SaveStatus.Complete)
            {
                //config thành công
                this.cboStatus.SelectedValue = (byte)QT.Entities.Common.ProductStatus.SPGocConfig;
                if (!Save())
                {
                    MessageBox.Show("Xảy ra lỗi!");
                }
                else
                {
                    this.ctrProductIdentity1.UpdateRootID();
                    LogJobAdapter.SaveLog(JobName.FrmManagerProduct_Luu, "Ấn nút lưu phân tích dữ liệu", Common.Obj2Int64(iDTextBox.Text), (int)JobTypeData.Product);
                }
            }
        }
コード例 #6
0
 private void addNew(EventArgs e)
 {
     QT.Moduls.Company.DBComTableAdapters.Job_WebsiteConfigLogTableAdapter adtJob = new QT.Moduls.Company.DBComTableAdapters.Job_WebsiteConfigLogTableAdapter();
     adtJob.Connection.ConnectionString = Server.ConnectionString;
     Company.frmAddWeb frm = new Company.frmAddWeb();
     frm.Text = "Thêm mới website";
     if (frm.ShowDialog() == DialogResult.OK)
     {
         TimeSpan timestartup = new TimeSpan(0, 1, 1, 0);
         TimeSpan timeSleep   = new TimeSpan(0, 1, 1, 0);
         Uri      uri         = new Uri(frm.Website);
         String   domain      = uri.Host.ToLower();
         domain = domain.Replace("www.", "");
         Alexa a = new Alexa();
         a = Common.GetRankAlexa(uri.Host);
         try
         {
             this.companyTableAdapter1.Insert(
                 Common.GetIDCompany(domain),
                 "",
                 "",
                 frm.Website,
                 domain,
                 DateTime.Now,
                 "",
                 "",
                 "",
                 "",
                 Common.CompanyStatus.NOTCONFIG,
                 "",
                 a.AlexaRankContries,
                 a.AlexaRank,
                 timestartup,
                 timeSleep,
                 0,
                 0,
                 DateTime.Now,
                 DateTime.Now,
                 30,
                 0,
                 0,
                 0,
                 "",
                 DateTime.Now,
                 0, 0, "", false, 0, DateTime.Now.AddYears(-1), DateTime.Now.AddYears(-1));
             adtJob.Insert(QT.Users.User.UserID, Common.GetIDCompany(domain), "", "", QT.Users.JobNhapLieuStatus.NhapMoi, DateTime.Now);
             LogJobAdapter.SaveLog(JobName.FrmCompany_AddNew, "Thêm mới công ty " + domain, Convert.ToInt64(Common.GetIDCompany(domain)), (int)JobTypeData.Company);
         }
         catch (Exception)
         {
             MessageBox.Show("Website này đã có trong hệ thống");
         }
         _command            = Common.ListWebCommand.ViewProfile;
         GetIDCompanyCurrent = Common.GetIDCompany(domain);
         ExcuteCommand(_command, e);
     }
 }
コード例 #7
0
        private void btSave_Click(object sender, EventArgs e)
        {
            this.productBindingSource.EndEdit();
            this.productTableAdapter.Update(dBProperties.Product);
            DialogResult = DialogResult.OK;
            long idProduct = QT.Entities.Common.Obj2Int64(iDTextBox.Text);

            LogJobAdapter.SaveLog(JobName.FrmEditeProductByCat_Them_moi_san_pham_goc, "Thêm mới sản phẩm gốc bằng tay!", idProduct, (int)JobTypeData.Product);
            this.Close();
        }
コード例 #8
0
 private void btnIdentify_Click(object sender, EventArgs e)
 {
     IdentifyProducts();
     if (_productID != 0)
     {
         LogJobAdapter.SaveLog(JobName.FrmManagerProduct_Nhan_dien_san_pham, "Phân tích sản phẩm " + richTextBoxKeywords.Text + " - " + richTextBoxExcludeKeywords.Text
                               + " - Max " + spinEditMaxPrice.Text + " - Min " + spintEditMinPrice.Text + " - " + richTextBoxConfusedProductList.Text + " - " + richTextBoxProductBlackList.Text
                               + " - " + richTextBoxCompanyBlackList.Text + " - " + richTextBoxAdditionProductIDs.Text + " - " + richTextBoxNote.Text + " - NumFound: " + textBoxNumFound.Text, _productID, (int)JobTypeData.Product);
     }
 }
コード例 #9
0
 private void toolXoa_Click(object sender, EventArgs e)
 {
     if (this.validCheckBox.Checked != true)
     {
         LogJobAdapter.SaveLog(JobName.FrmEditeProductByCat_Xoa_San_pham_goc, "Click vào nút Xóa trên Form Nhập sản phẩm gốc.", Common.Obj2Int64(iDProductTextBox.Text), (int)JobTypeData.KhongXacDinh);
         this.productBindingSource.RemoveCurrent();
         this.productBindingSource.EndEdit();
         gridView2.FocusedRowHandle++;
     }
 }
コード例 #10
0
 private void DeleteSPGocTrungTenButton_Click(object sender, EventArgs e)
 {
     try
     {
         productTableAdapter.DeleteSPGocTrungTen();
         LogJobAdapter.SaveLog(JobName.FrmManagerProduct_Xoa_trung_ten, "Xóa các sản phẩm gốc bị trùng tên, nên k có ID", 0, (int)JobTypeData.KhongXacDinh);
         MessageBox.Show("Xoá thành công!");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error {0}", ex.Message);
     }
 }
コード例 #11
0
 private void btAutoSave_Click(object sender, EventArgs e)
 {
     LogJobAdapter.SaveLog(JobName.FrmEditeProductByCat_AutoSave, "Click vào nút AutoSave trên Form Nhập sản phẩm gốc. Các ID sản phẩm đc thay đổi sẽ lưu ở log tiếp theo...", 0, (int)JobTypeData.KhongXacDinh);
     this.productBindingSource.MoveFirst();
     if (this.productBindingSource.Count > 0)
     {
         for (int i = 0; i < this.productBindingSource.Count; i++)
         {
             this.Save();
             this.productBindingSource.MoveNext();
             Application.DoEvents();
         }
     }
 }
コード例 #12
0
        private void btBiLoi_Click(object sender, EventArgs e)
        {
            this.cboJobStatus.SelectedValue = JobNhapLieuStatus.BiLoi;
            this.job_SPGocNhapLieuTableAdapter.UpdateQuery_Status(JobNhapLieuStatus.BiLoi, DateTime.Now, Common.Obj2Int(iDJobTextBox.Text));
            this.job_SPGocNhapLieuLogTableAdapter.DeleteQuery_IDJob_IDStatus(Common.Obj2Int(iDJobTextBox.Text), JobNhapLieuStatus.BiLoi);
            this.job_SPGocNhapLieuLogTableAdapter.Insert(Common.Obj2Int(iDJobTextBox.Text), JobNhapLieuStatus.BiLoi, DateTime.Now);
            this.gridControl2.Focus();
            var statusjob = (int)cboJobStatus.SelectedItem;

            if (statusjob != JobNhapLieuStatus.BiLoi)
            {
                long idProduct = Common.Obj2Int64(iDProductTextBox.Text);
                LogJobAdapter.SaveLog(JobName.FrmEditeProductByCat_Chuyen_trang_thai_san_pham, "Chuyển trạng thái sản phẩm sang Bị lỗi", idProduct, (int)JobTypeData.Product);
            }
        }
コード例 #13
0
 private void toolTaiLai_Click(object sender, EventArgs e)
 {
     try
     {
         QT.Entities.Wait.Show("Đang tải dữ liệu");
         this.productTableAdapter.FillBy_AllProductID(this.dBPMan.Product);
         LogJobAdapter.SaveLog(JobName.FrmEditeTenSanPham_Load_All, "Ấn nút Load All nên ko có ID", 0, (int)JobTypeData.KhongXacDinh);
         this.gridView1.ExpandAllGroups();
         Wait.Close();
     }
     catch (Exception)
     {
         Wait.Close();
     }
 }
コード例 #14
0
 private void btSaveDanhSach_Click(object sender, EventArgs e)
 {
     this.productBindingSource.EndEdit();
     if (dBProperties.Product.GetChanges() != null)
     {
         //DataTable dt = dBProperties.Product.GetChanges();
         //DataTable d2 = productBindingSource.Chan
         //int a = dt.Rows.Count;
         //foreach (DataRow item in dBProperties.Product.GetChanges())
         //{
         //    long idProduct = Common.Obj2Int64(item["ID"].ToString());
         LogJobAdapter.SaveLog(JobName.FrmEditeProductByCat_Luu_danh_sach, "Click vào nút lưu danh sách sản phẩm gốc được load by cat. Thay đổi cả bảng Product nên ko có ID Product", 0, (int)JobTypeData.KhongXacDinh);
         //}
     }
     this.productTableAdapter.Update(dBProperties.Product);
 }
コード例 #15
0
 private void toolTaiLai_Click(object sender, EventArgs e)
 {
     Wait.Show("Đang tải dữ liệu!");
     try
     {
         this.productTableAdapter.FillBy_AllProductID(this.dBPMan.Product);
         this.gridView1.ExpandAllGroups();
         this.xtraTabControl1.SelectedTabPageIndex = 1;
         LogJobAdapter.SaveLog(JobName.FrmManagerProduct_Load_All, "Click nút Load All nên ko có ID...", 0, (int)JobTypeData.KhongXacDinh);
     }
     catch (Exception)
     {
         throw;
     }
     Wait.Close();
 }
コード例 #16
0
 private void toolStripButtonDeleteAllthuocTinh_Click(object sender, EventArgs e)
 {
     this.productPropertiesBindingSource.MoveFirst();
     if (this.productPropertiesBindingSource.Count > 0)
     {
         for (int i = 0; i < this.productPropertiesBindingSource.Count; i++)
         {
             //if (this.productPropertiesBindingSource.Count > 0)
             //{
             this.productPropertiesBindingSource.RemoveCurrent();
             this.productPropertiesBindingSource.EndEdit();
             //    this.productPropertiesBindingSource.MoveNext();
             //}
         }
         LogJobAdapter.SaveLog(JobName.FrmEditeProductByCat_Xoa_het_gia_tri_thuoc_tinh, string.Format("Xóa hết giá trị thuộc tính của sản phẩm. Count = {0}", this.productPropertiesBindingSource.Count), Common.Obj2Int64(iDProductTextBox.Text), (int)JobTypeData.Product);
     }
 }
コード例 #17
0
 public override bool Save()
 {
     try
     {
         this.productBindingSource.EndEdit();
         foreach (DataRow item in dBPMan.Product.GetChanges().Rows)
         {
             long idProduct = Common.Obj2Int64(item["ID"].ToString());
             LogJobAdapter.SaveLog(JobName.FrmEditeTenSanPham_Luu_du_lieu, "Dữ liệu thay đổi ấn lưu dữ liệu form Đổi tên sản phẩm", idProduct, (int)JobTypeData.Product);
         }
         this.productTableAdapter.Update(dBPMan.Product);
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
コード例 #18
0
        public override bool Save()
        {
            try
            {
                this.lastUpdateDateTimePicker.Value = DateTime.Now;
                this.productTableAdapter.Update_SaveEditeRootProduct(
                    (short)cboStatus.SelectedValue,
                    lastUpdateDateTimePicker.Value,
                    nameTextBox.Text.Trim(),
                    Common.UnicodeToKoDauFulltext(nameTextBox.Text),
                    this.validCheckBox.Checked, imageUrlsTextEdit.Text, Common.Obj2Int(addPositionTextEdit.Text),
                    Common.Obj2Int64(iDTextBox.Text));
                this.ctrProductIdentity1.SaveProductIdentity();
                LogJobAdapter.SaveLog(JobName.FrmManagerProduct_Luu_Product, "Lưu thông tin sản phẩm ở form nhận diện", Common.Obj2Int64(iDTextBox.Text), (int)JobTypeData.Product);
                //ctrProducAnanytic2.SaveAnanytic();
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
コード例 #19
0
        public override bool Save()
        {
            // gán idvalue
            this.dateLastUpdate.DateTime = DateTime.Now;
            productPropertiesBindingSource.MoveFirst();
            for (int i = 0; i < productPropertiesBindingSource.Count; i++)
            {
                bool checkInsert = false;
                this.propertiesValueIDTextBox.Text = GetIDValue(Common.Obj2Int(this.hasNameTextBox.Text), out checkInsert).ToString();
                try
                {
                    if (checkInsert)
                    {
                        this.propertiesValueTableAdapter.Insert(Common.Obj2Int(this.propertiesValueIDTextBox.Text),
                                                                this.valueNameTextBox.Text,
                                                                Common.Obj2Int(this.propertiesIDTextBox.Text),
                                                                true,
                                                                Common.Obj2Int(this.propertiesValueIDTextBox.Text),
                                                                Common.Obj2Int(this.hasNameTextBox.Text), 0);
                    }
                }
                catch (Exception)
                {
                }
                productPropertiesBindingSource.MoveNext();
            }

            this.productPropertiesBindingSource.EndEdit();
            this.product_PropertiesTableAdapter.Update(dBProperties.Product_Properties);
            this.productDetailBindingSource.EndEdit();
            this.productDetailTableAdapter.Update(dBProperties.ProductDetail);
            long idproduct = Common.Obj2Int64(productIDTextBox.Text);

            LogJobAdapter.SaveLog(JobName.FrmEditeProductByCat_Save_gia_tri_thuoc_tinh, "Lưu lại giá trị thuộc tính của sản phẩm gốc", idproduct, (int)JobTypeData.Product);
            return(true);
        }
コード例 #20
0
        void doConvertSPGoc()
        {
            this.Invoke((MethodInvoker) delegate
            {
                this.lamssconvert.Text = "Start convert";
            });
            DBPManTableAdapters.ProductTableAdapter adtProduct = new DBPManTableAdapters.ProductTableAdapter();
            DBPMan.ProductDataTable dtP = new DBPMan.ProductDataTable();
            adtProduct.Connection.ConnectionString = Server.ConnectionString;
            int i = 0;

            foreach (DBMap.ProductRow dr in dBMap.Product)
            {
                //if (Common.Obj2Int64(dr.ProductID) <= 0)
                //{
                //insert to productid
                // vatgia
                if ((dBMap.Product.Rows[i]["ImageUrls"].ToString().Trim() != "")
                    //&& (dBMap.Product.Rows[i]["ProductContent"].ToString().Trim().Length > 10)
                    && (dBMap.Product.Rows[i]["ImageUrls"].ToString().Trim() != ""))
                {
                    int ID = Common.GetID_ProductID(dr.Name, IDCategory);
                    try
                    {
                        string name      = dr.Name.Replace("- Thông số kỹ thuật", "").Trim();
                        string contentft = Common.UnicodeToKoDauFulltext(name + " " + labelControlListIDSearch.Text);
                        if (adtProduct.Connection.State == ConnectionState.Closed)
                        {
                            adtProduct.Connection.Open();
                        }
                        try
                        {
                            /// check san pham nay da được tạo chưa
                            /// nếu chưa thì insert
                            /// đã có thì update lại thông số kỹ thuật
                            ///
                            dtP = new DBPMan.ProductDataTable();
                            adtProduct.FillBy_CheckID(dtP, ID);
                            if (dtP.Rows.Count > 0)
                            {
                                //adtProduct.UpdateQuery_SPGoc(
                                //    12,
                                //    Common.GetIDCompany("quangtrung.vn"),
                                //    DateTime.Now,
                                //    dBMap.Product.Rows[i]["ProductContent"].ToString(),
                                //    name,
                                //    dr.DetailUrl,
                                //    dr.ImageUrls,
                                //    Common.UnicodeToKoDauFulltext(name),
                                //    false,
                                //    Common.GetHashNameProduct("quangtrung.vn", name),
                                //    "",
                                //    IDCategory,
                                //    ID);
                            }
                            else
                            {
                                // chuyển sang làm sản phẩm gốc
                                adtProduct.InsertQuery_SPGoc(
                                    ID,
                                    Common.GetIDCompany("quangtrung.vn"),
                                    DateTime.Now,
                                    name,
                                    dBMap.Product.Rows[i]["ProductContent"].ToString(),
                                    name,
                                    dr.DetailUrl,
                                    dr.ImageUrls,
                                    Common.UnicodeToKoDauFulltext(name) + " " + NameCategory + " " + Common.UnicodeToKoDauFulltext(NameCategory),
                                    false,
                                    Common.GetHashNameProduct("quangtrung.vn", name),
                                    "",
                                    IDCategory,
                                    Common.Obj2Int(dBMap.Product.Rows[i]["Price"].ToString()),
                                    dr.ID,  // lưu product id vào trường classification vì productid chỉ là kiểu int
                                    contentft);
                                LogJobAdapter.SaveLog(JobName.FrmEditeProductByCat_Them_moi_san_pham_goc, "Thêm mới sản phẩm gốc MAP PRODUCT!", ID, (int)JobTypeData.Product);
                            }
                            dtP.Dispose();
                            List <PropertyEntyties> ls = new List <PropertyEntyties>();
                            ls = ContentAnalytic.GetListProperties(dBMap.Product.Rows[i]["ProductContent"].ToString().Trim(),
                                                                   dBMap.Product.Rows[i]["DetailUrl"].ToString().Trim());
                            ContentAnalytic.UpdateContent(ID, ls);
                        }
                        catch (Exception)
                        {
                            //  tên sản phẩm trong chuyên mục này đã có
                        }

                        // update lại sản phẩm vừa chuyển đã chuyển
                        adtProduct.UpdateQuery_ProductID(ID, dr.ID);
                    }
                    catch (Exception)
                    {
                    }
                    this.Invoke((MethodInvoker) delegate
                    {
                        this.lamssconvert.Text = string.Format("{0}/{1} - {2}", i, dBMap.Product.Count, dr.Name);
                    });
                    Application.DoEvents();
                    adtProduct.Connection.Close();
                    //String[] images = dBMap.Product.Rows[i++]["Promotion"].ToString().Split('\n');
                    //if ((images.Length > 0) && (images[0].Trim().Length > 0))
                    //{

                    //try
                    //{
                    //    adtID.Insert(
                    //    ID,
                    //    images[0].ToString(),
                    //    IDCategory,
                    //    0, 0, 0,
                    //    dr.ProductContent,
                    //    dr.DetailUrl,
                    //    dr.Name,
                    //    dr.NameFT,
                    //    Common.Obj2Int(Common.ProductIDStatus.NotValid));
                    //}
                    //catch (Exception)
                    //{

                    //}

                    //}
                }
                //}
                i++;
            }
        }
コード例 #21
0
 private void toolTaiCat_Click(object sender, EventArgs e)
 {
     LogJobAdapter.SaveLog(JobName.FrmEditeTenSanPham_Load_Cat, "Ấn nút Load Cat nên ko có ID", 0, (int)JobTypeData.KhongXacDinh);
     check = chkTimChinhXac.Checked;
     RefreshData();
 }
コード例 #22
0
        private void btLogin_Click(object sender, EventArgs e)
        {
            try
            {
                String connection = "Data Source=42.112.28.93;Initial Catalog=QT_2;Persist Security Info=True;User ID=wss_price;Password=HzlRt4$$axzG-*UlpuL2gYDu;connection timeout=200";
                //String connectionCrawler = "Data Source=192.168.100.183;Initial Catalog=QTCrawler;Integrated Security=False;User=sa;Password=123";
                //String connectionCrawler = @"Data Source=192.168.100.183;Initial Catalog=SaleNews;Integrated Security=False;User=sa;Password=123";
                String connectionCrawler = "Data Source=172.22.30.82,1452;Initial Catalog=QTCrawler;Persist Security Info=True;User ID=qt_vn;Password=@F4sJ=l9/ryJt9MT;connection timeout=200";
                String logConnection     = "Data Source=172.22.30.86,1455;Initial Catalog=QT_2;Persist Security Info=True;User ID=qt_vn;Password=@F4sJ=l9/ryJt9MT;connection timeout=200";

                switch (QT.Entities.Server.ServerRun)
                {
                case "store":
                    connection = connection.Replace("42.112.28.93", ".");
                    break;

                case "hvtcphc":
                    logConnection     = logConnection.Replace("118.70.205.94", "172.16.34.86");
                    connectionCrawler = connectionCrawler.Replace("118.70.205.94", ".");
                    break;

                case "hvtcdn":
                    logConnection     = logConnection.Replace("118.70.205.94", "10.168.200.86");
                    connectionCrawler = connectionCrawler.Replace("118.70.205.94", "10.168.200.82");
                    break;

                case "fpt":
                    connection = connection.Replace("42.112.28.93", "172.22.1.82");
                    break;
                }
                QT.Entities.Server.ConnectionString        = connection;
                QT.Entities.Server.ConnectionStringCrawler = connectionCrawler;
                QT.Entities.Server.LogConnectionString     = logConnection;

                adt.Connection.ConnectionString = QT.Entities.Server.ConnectionString;
                //adt.FillBy_UserPass(dt, txtUser.Text.Trim(), Common.GetPassWord(txtPass.Text.Trim()));
                adt.FillBy_UserPass(dt, txtUser.Text.Trim(), Bussiness.CryptoWSS.Encrypt(txtPass.Text.Trim()));

                if (dt.Rows.Count > 0)
                {
                    DialogResult           = DialogResult.OK;
                    QT.Users.User.UserName = txtUser.Text.Trim();
                    QT.Users.User.UserID   = Common.Obj2Int(dt.Rows[0]["ID"].ToString());
                    //Check Quyền
                    DBTableAdapters.User_PermisionTableAdapter userpermisionAdapter = new DBTableAdapters.User_PermisionTableAdapter();
                    userpermisionAdapter.Connection.ConnectionString = QT.Entities.Server.ConnectionString;
                    DB.User_PermisionDataTable userpermissionTable = new DB.User_PermisionDataTable();
                    userpermisionAdapter.FillBy_IDUser(userpermissionTable, QT.Users.User.UserID);
                    if (userpermissionTable.Rows.Count > 0)
                    {
                        List <int> listper = new List <int>();
                        for (int i = 0; i < userpermissionTable.Rows.Count; i++)
                        {
                            listper.Add(Common.Obj2Int(userpermissionTable.Rows[i]["IDPermission"].ToString()));
                        }
                        QT.Users.User.PermisionID = listper;
                    }

                    QT.Entities.Server.UserID = QT.Users.User.UserID;
                    //Log đăng nhập
                    LogJobAdapter.SaveLog(JobName.Login, "Đăng nhập Manager", 0, (int)JobTypeData.KhongXacDinh);

                    this.Close();
                }
                else
                {
                    MessageBox.Show("User hoặc mật khẩu không dúng, liên hệ với admin");
                    this.txtUser.Focus();
                    this.txtUser.SelectAll();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Không kết nối được, bạn hãy thử kiểm tra lại mạng");
            }
        }