コード例 #1
0
 private void grvData_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
 {
     if (e.RowHandle >= 0)
     {
         string code = TextUtils.ToString(grvData.GetRowCellValue(e.RowHandle, grvData.Columns[0]));
         if (code == "1" || code == "5" || code == "18" || code == "26")
         {
             e.Appearance.BackColor = Color.Yellow;
         }
     }
 }
コード例 #2
0
        private void loadCombo()
        {
            object takt = TextUtils.ExcuteScalar("Select Takt from AndonConfig");

            txtTakt.Text = TextUtils.ToString(takt);
            DataTable data = TextUtils.LoadDataFromSP("spGetShift", "Shift", new string[] { }, new object[] { });

            cbxShiftType.DataSource    = data;
            cbxShiftType.DisplayMember = "hourTime";
            cbxShiftType.ValueMember   = "ID";
        }
コード例 #3
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (!grvData.IsDataRow(grvData.FocusedRowHandle))
     {
         return;
     }
     setInterface(true);
     _isAdd       = false;
     txtName.Text = TextUtils.ToString(grvData.GetFocusedRowCellValue("ProductTypeName"));
     txtCode.Text = TextUtils.ToString(grvData.GetFocusedRowCellValue("ProductTypeCode"));
 }
コード例 #4
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (!grvData.IsDataRow(grvData.FocusedRowHandle))
     {
         return;
     }
     SetInterface(true);
     _isAdd              = false;
     txtCode.Text        = TextUtils.ToString(grvData.GetRowCellValue(grvData.FocusedRowHandle, "Code"));
     txtDescription.Text = TextUtils.ToString(grvData.GetRowCellValue(grvData.FocusedRowHandle, "Description"));
 }
コード例 #5
0
ファイル: frmHistoryCheck.cs プロジェクト: Dung12345678/Dao
 private void btnShowHistoryCheckOrderDetail_Click(object sender, EventArgs e)
 {
     if (grvData.RowCount > 0)
     {
         frmHistoryCheckOrderDetail frm = new frmHistoryCheckOrderDetail();
         frm._QRCode    = TextUtils.ToString(grvData.GetFocusedRowCellValue(colQRCode));
         frm._DateLR    = TextUtils.ToDate3(grvData.GetFocusedRowCellValue(colDateLR));
         frm._OrderCode = TextUtils.ToString(grvData.GetFocusedRowCellValue(colOrderCode));
         frm.Show();
     }
 }
コード例 #6
0
 private void btnSaveAreaPLC_Click(object sender, EventArgs e)
 {
     foreach (DataRowView r in _bindingSource)
     {
         ConfigPLCModel configPLC = ConfigPLCBO.Instance.FindByPK(TextUtils.ToInt(r.Row["ID"])) as ConfigPLCModel;
         configPLC.AreaDelay = TextUtils.ToString(r.Row["AreaDelay"]);
         configPLC.AreaRisk  = TextUtils.ToString(r.Row["AreaRisk"]);
         ConfigPLCBO.Instance.Update(configPLC);
     }
     MessageBox.Show("Config address area successfully!", "Notice", MessageBoxButtons.OK);
     grvAreaPLC.DataSource = _bindingSource;
 }
コード例 #7
0
        private void btnXemTatCa_Click(object sender, EventArgs e)
        {
            string[] _paraName  = new string[3];
            object[] _paraValue = new object[3];

            _paraName[0] = "@StartDate"; _paraValue[0] = TextUtils.ToDate2(dtpStartDate.EditValue);
            _paraName[1] = "@EndDate"; _paraValue[1] = TextUtils.ToDate2(dtpEndDate.EditValue);
            _paraName[2] = "@DepartmentId"; _paraValue[2] = TextUtils.ToString(cboDepartment.EditValue);
            DataTable Source = LibQLSX.LoadDataFromSP("spReport_NKCV_ForDate", "Source", _paraName, _paraValue);

            grdData.DataSource = Source;
        }
コード例 #8
0
        void saveDN(ProcessTransaction pt, int count, DataRow row)
        {
            int     stt = TextUtils.ToInt(row["F1"]);
            decimal qty = TextUtils.ToDecimal(row["F7"]);

            C_QuotationDetail_SXModel item = new C_QuotationDetail_SXModel();

            item.C_QuotationID = Quotation.ID;
            item.ParentID      = 0;
            item.Qty           = item.QtyT = qty;
            item.PriceVT       = TextUtils.ToDecimal(row["F41"]);
            item.PriceVTTN     = TextUtils.ToDecimal(row["F42"]);
            item.PriceVTPS     = TextUtils.ToDecimal(row["F43"]);
            item.Manufacture   = TextUtils.ToString(row["F4"]);
            item.ModuleCode    = TextUtils.ToString(row["F3"]);
            item.ModuleName    = TextUtils.ToString(row["F2"]);
            item.Origin        = TextUtils.ToString(row["F5"]);

            item.C_ProductGroupID = TextUtils.ToInt(LibQLSX.ExcuteScalar("select ID from C_ProductGroup where Code = '" + TextUtils.ToString(row["F6"]) + "'"));

            item.ID = (int)pt.Insert(item);
            count++;
            row["ID"] = item.ID;

            DataRow[] drs = _dtData.Select("F1 like '" + stt + ".%'");
            foreach (DataRow rowC in drs)
            {
                decimal qtyC      = TextUtils.ToDecimal(rowC["F7"]);
                string  groupCode = TextUtils.ToString(rowC["F6"]);

                int groupID = TextUtils.ToInt(LibQLSX.ExcuteScalar("select ID from C_ProductGroup where Code = '" + groupCode + "'"));

                C_QuotationDetail_SXModel itemC = new C_QuotationDetail_SXModel();
                itemC.C_QuotationID    = Quotation.ID;
                itemC.ParentID         = item.ID;
                itemC.C_ProductGroupID = groupID;

                itemC.Qty       = qtyC;
                itemC.QtyT      = qtyC / item.Qty;
                itemC.PriceVT   = TextUtils.ToDecimal(rowC["F41"]);
                itemC.PriceVTTN = TextUtils.ToDecimal(row["F42"]);
                itemC.PriceVTPS = TextUtils.ToDecimal(row["F43"]);

                itemC.ModuleName  = TextUtils.ToString(rowC["F2"]);
                itemC.ModuleCode  = TextUtils.ToString(rowC["F3"]);
                itemC.Manufacture = TextUtils.ToString(rowC["F4"]);
                itemC.Origin      = TextUtils.ToString(rowC["F5"]);

                itemC.ID   = (int)pt.Insert(itemC);
                rowC["ID"] = itemC.ID;
                count++;
            }
        }
コード例 #9
0
ファイル: frmImportProducts.cs プロジェクト: B06-0253/NVTHAO
        private void button2_Click(object sender, EventArgs e)
        {
            string projectCode      = TextUtils.ToString(cboProject.EditValue);
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            if (fbd.ShowDialog() == DialogResult.OK)
            {
                treeData.ExportToXls(fbd.SelectedPath + "\\" + projectCode + ".xls");
            }

            //treeData.ExportToXls();
        }
コード例 #10
0
        private void xemDanhSáchModuleChứaMạchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string code = TextUtils.ToString(grvData.GetFocusedRowCellValue(colCode));
            string name = TextUtils.ToString(grvData.GetFocusedRowCellValue(colName));

            frmModelContained frm = new frmModelContained();

            frm.MaterialCode = code;
            frm.MaterialName = name;
            //frm.DisplayType = 1;
            frm.Show();
        }
コード例 #11
0
        private void ClearInterface()
        {
            object takt = TextUtils.ExcuteScalar("Select Takt from AndonConfig");

            txtTakt.Text = TextUtils.ToString(takt);
            DateTime date = DateTime.Now.Date;

            pickerStartDate.Value = date;
            pickerStartTime.Value = date.AddHours(8);
            pickerEndDate.Value   = date;
            pickerEndTime.Value   = date.AddHours(12);
        }
コード例 #12
0
 void loadPart()
 {
     using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load dữ liệu..."))
     {
         string proposalCode = TextUtils.ToString(grvYC.GetFocusedRowCellValue(colCode));
         string sql          =
             "select *,DATEDIFF(day, DateAboutE, DateAboutF) as Period from [dbo].[vRequirePartFull_Order] where ProposalCode ='" +
             proposalCode + "'";
         DataTable dt = LibQLSX.Select(sql);
         grdYCDetail.DataSource = dt;
     }
 }
コード例 #13
0
        private void btnAddVT_Click(object sender, EventArgs e)
        {
            frmListMaterial frm = new frmListMaterial();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang thêm vật tư..."))
                {
                    foreach (DataRow r in frm.dtAll.Rows)
                    {
                        string code = TextUtils.ToString(r["Code"]);
                        if (code == "")
                        {
                            continue;
                        }
                        DataRow[] drs = _dtDMVT.Select("Code = '" + code + "'");
                        if (drs.Length > 0)
                        {
                            continue;
                        }
                        decimal tonKho = TextUtils.ToDecimal(r["TonKho"]);

                        //string sqlM = "SELECT top 1 * FROM  vGetPriceOfPart with(nolock)"
                        //                + " WHERE Price > 1 AND replace(replace([PartsCode],'/','#'),')','#') = '"
                        //                + code.Replace(" ", "").Replace("/", "#").Replace(")", "#") + "'"
                        //                + " ORDER BY DateAboutF DESC";
                        //DataTable dtPrice = LibQLSX.Select(sqlM);

                        string    sqlM    = "exec spGetPriceOfPart '" + code.Replace(" ", "").Replace("/", "#").Replace(")", "#") + "'";
                        DataTable dtPrice = LibQLSX.Select(sqlM);

                        DataRow dr = _dtDMVT.NewRow();
                        dr["Code"]       = r["Code"].ToString();
                        dr["Name"]       = r["Name"].ToString();
                        dr["Hang"]       = r["Hang"].ToString();
                        dr["Unit"]       = r["Unit"].ToString();
                        dr["QtyTon"]     = tonKho;
                        dr["SolutionID"] = TextUtils.ToInt(Solution.ID);
                        if (dtPrice.Rows.Count > 0)
                        {
                            dr["Price"] = TextUtils.ToDecimal(dtPrice.Rows[0]["Price"]).ToString("n0");
                        }
                        else
                        {
                            dr["Price"] = TextUtils.ToDecimal(r["Price"]).ToString("n0");
                        }
                        dr["TotalPrice"] = TextUtils.ToDecimal(dr["Price"]).ToString("n0");
                        dr["Qty"]        = 1;
                        _dtDMVT.Rows.Add(dr);
                    }
                }
            }
        }
コード例 #14
0
ファイル: frmListCumOfModule.cs プロジェクト: B06-0253/NVTHAO
        private void treeData_DoubleClick(object sender, EventArgs e)
        {
            string stt = TextUtils.ToString(treeData.FocusedNode.GetValue(colSTT));
            frmListPartOfModule frm = new frmListPartOfModule();

            frm.ProjectModuleId = ProjectModuleId;
            frm.ModuleCode      = TextUtils.ToString(treeData.FocusedNode.GetValue(colCodeTK));
            frm.TotalReal       = TextUtils.ToDecimal(treeData.FocusedNode.GetValue(colQty));
            frm.ProjectId       = ProjectId;
            frm.STT             = stt;
            frm.Show();
        }
コード例 #15
0
        private void btnDownload3D_Click(object sender, EventArgs e)
        {
            if (grvDMVTC.RowCount == 0)
            {
                return;
            }
            using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang download file 3D"))
            {
                DocUtils.InitFTPTK();
                string moduleCode  = Path.GetFileNameWithoutExtension(txtDMVTPath.Text).Substring(6, 10);
                string localFolder = string.Format(@"D:\Thietke.Ck\{0}\{1}.Ck\3D.{1}\COM.{1}", moduleCode.Substring(0, 6), moduleCode);
                if (!Directory.Exists(localFolder))
                {
                    Directory.CreateDirectory(localFolder);
                }
                for (int i = 0; i < grvDMVTC.RowCount; i++)
                {
                    string code = TextUtils.ToString(grvDMVTC.GetRowCellValue(i, colCode3));
                    string hang = TextUtils.ToString(grvDMVTC.GetRowCellValue(i, colHang3));

                    if (code == "")
                    {
                        continue;
                    }
                    if (hang == "")
                    {
                        continue;
                    }

                    Directory.CreateDirectory(localFolder + "//" + hang);

                    DataTable dtMaterialFile = TextUtils.Select("select * from [MaterialFile] with(nolock) where FileType = 0 and replace(Name,' ','') = '"
                                                                + code.Replace(" ", "") + ".ipt'");

                    if (dtMaterialFile.Rows.Count == 0)
                    {
                        grvDMVTC.SetRowCellValue(i, colType3, "Không có file trên nguồn");
                        continue;
                    }

                    foreach (DataRow row in dtMaterialFile.Rows)
                    {
                        string serverFilePath = TextUtils.ToString(row["Path"]);
                        if (!DocUtils.CheckExits(serverFilePath))
                        {
                            continue;
                        }
                        DocUtils.DownloadFile(localFolder + "//" + hang, Path.GetFileName(serverFilePath), serverFilePath);
                    }
                }
            }
            MessageBox.Show("Đã hoàn thành download file 3D!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #16
0
ファイル: frmMisMatchManager.cs プロジェクト: mrgrey88/QLTK
        private void gửiMailBáoKhôngPhùHợpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string subject;
            string to;
            string content;

            using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load dữ liệu..."))
            {
                int           id          = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID));
                ModulesModel  product     = (ModulesModel)ModulesBO.Instance.FindByAttribute("Code", grvData.GetFocusedRowCellValue(colModuleCode).ToString())[0];
                string        productCode = product.Code;
                string        projectCode = TextUtils.ToString(grvData.GetFocusedRowCellValue(colProjectCode));
                List <string> listEmail   = getListMail(productCode);

                subject = string.Format("INVALID REPORT - {0} - {1}", grvData.GetFocusedRowCellValue(colCode).ToString(), productCode);

                DataTable dtProjectUser = LibQLSX.Select("SELECT p.ProjectCode, u.UserName FROM Project p INNER JOIN Users u ON p.UserId = u.UserId where p.ProjectCode='" + projectCode + "'");
                string    projectUser   = dtProjectUser.Rows.Count > 0 ? TextUtils.ToString(dtProjectUser.Rows[0][1]) : "";

                DataTable dtConfig = TextUtils.Select("select KeyValue from [ConfigSystem] where [KeyName]='KPH_To_TK_Email'");
                content = dtConfig.Rows[0][0].ToString();
                content = content.Replace("<ErrorCode>", "<b>" + grvData.GetFocusedRowCellValue(colCode).ToString() + "</b>")
                          .Replace("<ProjectCode>", "<b>" + projectCode + "</b>")
                          .Replace("<ProjectUser>", "<b>" + projectUser == "" ? "Không tìm thấy" : projectUser + "</b>")
                          .Replace("<ProductCode>", "<b>" + productCode + "</b>")
                          .Replace("<ProductName>", product.Name)
                          .Replace("<UserFind>", grvData.GetFocusedRowCellValue(colUserFindText).ToString())
                          .Replace("<Description>", grvData.GetFocusedRowCellValue(colDes).ToString())
                          .Replace("<Ck>", NVCoKhi == "" ? "Không tìm thấy" : NVCoKhi)
                          .Replace("<Dn>", NVDien == "" ? "Không tìm thấy" : NVDien)
                          .Replace("<Dt>", NVDT == "" ? "Không tìm thấy" : NVDT);
                to = "";
                foreach (string item in listEmail)
                {
                    to += item.ToLower() + ";";
                }
            }
            frmSendEmailAttach frm = new frmSendEmailAttach();

            frm.Subject = subject;
            frm.CC      = //"*****@*****.**";
                          "[email protected];[email protected];[email protected];[email protected];";
            frm.To      = to;
            frm.Content = content;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                MisMatchModel errorModel = (MisMatchModel)MisMatchBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)));
                errorModel.ConfirmSendMailKCS = Global.AppFullName + " - " + Environment.MachineName + " đã gửi mail vào ngày: " + DateTime.Now;
                MisMatchBO.Instance.Update(errorModel);
                loadGrid();
            }
        }
コード例 #17
0
ファイル: frmReportVoucher.cs プロジェクト: mrgrey88/QLTK
        private void btnSaveHistory_Click(object sender, EventArgs e)
        {
            int caseVoucherDebtID = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID));

            if (caseVoucherDebtID == 0)
            {
                return;
            }
            string completedDate = TextUtils.ToString(grvData.GetFocusedRowCellDisplayText(colCompletedDate));

            if (completedDate != "")
            {
                return;
            }

            if (dtpDateOut.EditValue == null)
            {
                MessageBox.Show("Bạn phải chọn ngày trả dự kiến.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            if (txtReason.Text.Trim() == "")
            {
                MessageBox.Show("Bạn phải nhập nguyên nhân gia hạn.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            CaseVoucherDebtHistoryModel model = new CaseVoucherDebtHistoryModel();

            model.CaseVoucherDebtID = caseVoucherDebtID;
            model.DateOut           = (DateTime?)dtpDateOut.EditValue;
            model.Reason            = txtReason.Text.Trim();
            CaseVoucherDebtHistoryBO.Instance.Insert(model);

            CaseVoucherDebtModel cModel = (CaseVoucherDebtModel)CaseVoucherDebtBO.Instance.FindByPK(caseVoucherDebtID);

            cModel.CompletedDateDK = model.DateOut;
            cModel.Reason          = model.Reason;
            CaseVoucherDebtBO.Instance.Update(cModel);

            MessageBox.Show("Gia hạn thành công!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);

            dtpDateOut.EditValue = null;
            txtReason.Text       = "";

            grvData.SetFocusedRowCellValue(colReason, model.Reason);
            grvData.SetFocusedRowCellValue(colCompletedDateDK, model.DateOut);
            hideControl(true);

            //_rownIndex = grvData.FocusedRowHandle;
            //loadData();
        }
コード例 #18
0
ファイル: frmBaoCaoLoi.cs プロジェクト: mrgrey88/QLTK
        private void btnConfirmManager_Click(object sender, EventArgs e)
        {
            string     createdby         = TextUtils.ToString(grvData.GetFocusedRowCellValue(colCreatedBy));
            int        departmentCurrent = Global.DepartmentID;
            ArrayList  userArray         = UsersBO.Instance.FindByAttribute("LoginName", createdby);
            UsersModel user = new UsersModel();

            if (userArray != null)
            {
                if (userArray.Count > 0)
                {
                    user = (UsersModel)userArray[0];
                }
            }
            if (departmentCurrent != user.DepartmentID)
            {
                MessageBox.Show("Bạn không có quyền xác nhận lỗi này?", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            int count = 0;

            if (MessageBox.Show("Bạn có chắc muốn xác nhận những lỗi này là đúng?", TextUtils.Caption, MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                _rownIndex = grvData.FocusedRowHandle;

                foreach (int i in grvData.GetSelectedRows())
                {
                    if (i < 0)
                    {
                        continue;
                    }
                    int iD = TextUtils.ToInt(grvData.GetRowCellValue(i, colID));
                    ModuleErrorModel model = (ModuleErrorModel)ModuleErrorBO.Instance.FindByPK(iD);
                    if (model.ConfirmManager == 0)
                    {
                        model.ConfirmManager = 1;
                        ModuleErrorBO.Instance.Update(model);
                        count++;

                        sendKcsMail(i);
                    }
                }

                if (count > 0)
                {
                    //MessageBox.Show("Trưởng bộ phận xác nhận lỗi thành công!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    loadGrid();
                }
            }
        }
コード例 #19
0
ファイル: frmCheckCTGP.cs プロジェクト: B06-0253/NVTHAO
        private void mởĐườngDẫnToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path = TextUtils.ToString(grvData.GetFocusedRowCellDisplayText(colPath));

            try
            {
                Process.Start("explorer.exe", "/select, " + path);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
コード例 #20
0
ファイル: frmYCVTmanager.cs プロジェクト: B06-0253/NVTHAO
        private void grvYCVT_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            string RequestCode = TextUtils.ToString(grvYCVT.GetFocusedRowCellValue(colRCode));

            if (RequestCode == "")
            {
                return;
            }
            using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát", "Đang load vật tư"))
            {
                addRequestItem(RequestCode);
            }
        }
コード例 #21
0
ファイル: frmDepartmentQLSX.cs プロジェクト: B06-0253/NVTHAO
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (!grvData.IsDataRow(grvData.FocusedRowHandle))
     {
         return;
     }
     SetInterface(true);
     _isAdd                  = false;
     txtName.Text            = grvData.GetRowCellValue(grvData.FocusedRowHandle, "DName").ToString();
     txtCode.Text            = grvData.GetRowCellValue(grvData.FocusedRowHandle, "DCode").ToString();
     cboStatus.SelectedIndex = TextUtils.ToInt(grvData.GetRowCellValue(grvData.FocusedRowHandle, "IsUse"));
     cboLeader.EditValue     = TextUtils.ToString(grvData.GetFocusedRowCellValue(colLeader));
 }
コード例 #22
0
ファイル: UCShelf.cs プロジェクト: Dung12345678/Xk
 private void UCShelf_Load(object sender, EventArgs e)
 {
     lblGia.Text  = "GIÁ: " + NameShelf.Trim();
     lblSLTT.Text = "THỰC TẾ: " + TextUtils.ToString(Qty);
     //if (Qty == 0)
     //{
     //	this.BackColor = System.Drawing.Color.Lime;
     //}
     //else
     //{
     //	this.BackColor = System.Drawing.Color.Gray;
     //}
 }
コード例 #23
0
        private void loadShiftAndTaktTime()
        {
            object takt = TextUtils.ExcuteScalar("Select Takt from dbo.AndonConfig with(nolock)");

            txtTakt.Text = TextUtils.ToString(takt);
            DataTable data = TextUtils.Select("Select * from dbo.Shift with(nolock)");

            //ArrayList arr = ShiftBO.Instance.FindAll(
            //DataTable data = TextUtils.LoadDataFromSP("spGetShift", "Shift", new string[] { }, new object[] { });
            cbxShiftType.DataSource    = data;
            cbxShiftType.DisplayMember = "Name";
            cbxShiftType.ValueMember   = "ID";
        }
コード例 #24
0
ファイル: frmBieuMauKyThuat.cs プロジェクト: B06-0253/NVTHAO
 private void txtCode_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         string    filePath = @"\\SERVER\Company\Share\Chuyen giao\HDTH.xlsx";
         DataTable dt       = TextUtils.ExcelToDatatableNoHeader(filePath, "EX");
         DataRow[] drs      = dt.Select("F3 = '" + txtCode.Text.Trim() + "'");
         if (drs.Length > 0)
         {
             txtName.Text = TextUtils.ToString(drs[0]["F2"]).ToUpper();
         }
     }
 }
コード例 #25
0
        private void btnExecl_Click(object sender, EventArgs e)
        {
            string projectCode      = TextUtils.ToString(grvProject.GetFocusedRowCellValue(colProjectCode));
            string filePath         = "";
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            if (fbd.ShowDialog() == DialogResult.OK)
            {
                filePath = fbd.SelectedPath + "/" + projectCode + ".xls";
                treeData.ExportToXls(filePath);
            }
            Process.Start(filePath);
        }
コード例 #26
0
        private void btnDeleteFile_Click(object sender, EventArgs e)
        {
            DocUtils.InitFTPTK();
            if (grvFile.RowCount <= 0)
            {
                return;
            }

            int id = TextUtils.ToInt(grvFile.GetFocusedRowCellValue(colFileID));

            string filePath = TextUtils.ToString(grvFile.GetFocusedRowCellValue(colFileLocalPath));
            string fileName = Path.GetFileName(filePath);

            if (MessageBox.Show("Bạn có thật sự muốn xóa file [" + fileName + "] này không?", TextUtils.Caption,
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            if (id == 0)
            {
                grvFile.DeleteSelectedRows();
            }
            else
            {
                ProcessTransaction pt = new ProcessTransaction();
                pt.OpenConnection();
                pt.BeginTransaction();
                try
                {
                    pt.Delete("SolutionFile", id);

                    if (DocUtils.CheckExits(filePath))
                    {
                        DocUtils.DeleteFile(filePath);
                    }

                    pt.CommitTransaction();
                    grvFile.DeleteSelectedRows();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Xóa file [" + fileName + "] không thành công!" + Environment.NewLine + ex.Message,
                                    TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                finally
                {
                    pt.CloseConnection();
                }
            }
        }
コード例 #27
0
        void updateUser()
        {
            string         filePath = "";
            OpenFileDialog ofd      = new OpenFileDialog();

            ofd.Multiselect = false;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                filePath = ofd.FileName;
            }
            else
            {
                return;
            }
            DataTable dt = TextUtils.ExcelToDatatableNoHeader(filePath, "Sheet2");

            dt = dt.Select("F2 is not null and F2 <> ''").CopyToDataTable();
            DataTable dtUser = LibQLSX.Select("select * from Users with(nolock)");

            int count = 0;

            foreach (DataRow row in dt.Rows)
            {
                try
                {
                    string code = TextUtils.ToString(row["F2"]);
                    if (code == "")
                    {
                        continue;
                    }
                    string userName = TextUtils.ToString(row["F3"]);

                    DataRow[] drs = dtUser.Select("UserName = '******'");
                    if (drs.Length > 0)
                    {
                        string userId = TextUtils.ToString(drs[0]["UserId"]);

                        TPA.Model.UsersModel user = (TPA.Model.UsersModel)TPA.Business.UsersBO.Instance.FindByAttribute("UserId", userId)[0];
                        user.Code = code;

                        PartsBO.Instance.UpdateQLSX(user);
                        count++;
                    }
                }
                catch
                {
                }
            }
            MessageBox.Show(count.ToString());
        }
コード例 #28
0
ファイル: frmReportChiPhi.cs プロジェクト: B06-0253/NVTHAO
 private void grvData_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == (Keys.C))
     {
         try
         {
             string text = TextUtils.ToString(grvData.GetFocusedRowCellValue(grvData.FocusedColumn));
             Clipboard.SetText(text);
         }
         catch (Exception)
         {
         }
     }
 }
コード例 #29
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            string     id    = TextUtils.ToString(grvData.GetFocusedRowCellValue(colParstId));
            ArrayList  array = PartsBO.Instance.FindByAttribute("PartsId", id);
            PartsModel part  = (PartsModel)array[0];

            _rownIndex = grvData.FocusedRowHandle;

            frmMaterialQLSX frm = new frmMaterialQLSX();

            frm.Part            = part;
            frm.LoadDataChange += main_LoadDataChange;
            frm.Show();
        }
コード例 #30
0
ファイル: frmDepartmentQLSX.cs プロジェクト: B06-0253/NVTHAO
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (!checkValid())
                {
                    return;
                }
                DepartmentsModel dModel;
                string           departmentId = "";
                if (_isAdd)
                {
                    dModel = new DepartmentsModel();

                    DataTable dt = LibQLSX.Select("SELECT top 1 DepartmentId FROM Departments order by DepartmentId desc");
                    departmentId = TextUtils.ToString(dt.Rows[0]["DepartmentId"]);
                    string number = departmentId.Substring(1, 3);
                    departmentId = "D" + string.Format("{0:000}", TextUtils.ToInt(number) + 1);
                }
                else
                {
                    departmentId = TextUtils.ToString(grvData.GetRowCellValue(grvData.FocusedRowHandle, "DepartmentId"));
                    dModel       = (DepartmentsModel)DepartmentsBO.Instance.FindByAttribute("DepartmentId", departmentId)[0];
                }

                dModel.DepartmentId = departmentId;
                dModel.DCode        = txtCode.Text.Trim();
                dModel.DName        = txtName.Text.Trim();
                dModel.IsUse        = cboStatus.SelectedIndex;
                dModel.UserId       = TextUtils.ToString(cboLeader.EditValue);

                if (_isAdd)
                {
                    DepartmentsBO.Instance.InsertQLSX(dModel);
                }
                else
                {
                    DepartmentsBO.Instance.UpdateQLSX(dModel);
                }


                loadGrid();
                SetInterface(false);
                ClearInterface();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }