示例#1
0
 void loadProject()
 {
     try
     {
         DataTable tbl = LibQLSX.Select("exec spGetAllProject");
         TextUtils.PopulateCombo(cboProject, tbl, "ProjectName", "ProjectCode", "");
     }
     catch
     {
     }
 }
        void loadCombo()
        {
            DataTable dt = LibQLSX.Select("select * from C_Quotation with(nolock)");

            cboBaoGia.Properties.DataSource    = dt;
            cboBaoGia.Properties.DisplayMember = "Code";
            cboBaoGia.Properties.ValueMember   = "ID";

            cboBaoGia1.Properties.DataSource    = dt;
            cboBaoGia1.Properties.DisplayMember = "Code";
            cboBaoGia1.Properties.ValueMember   = "ID";
        }
示例#3
0
 void loadData()
 {
     try
     {
         DataTable tbl = LibQLSX.Select("Select * from PayVouchers with(nolock)");
         grdData.DataSource = tbl;
     }
     catch
     {
         grdData.DataSource = null;
     }
 }
示例#4
0
        private void frmSupplier_Load(object sender, EventArgs e)
        {
            loadUserFind();
            loadHangFind();
            loadMaterialGroup();
            if (Supplier.SupplierId != null)
            {
                txtAddress.Text         = Supplier.Address;
                txtAgency.Text          = Supplier.Agency;
                txtBankAccount.Text     = Supplier.BankAcount;
                txtBankAccountName.Text = Supplier.BankAcountName;
                txtBankName.Text        = Supplier.BankName;
                txtCode.Text            = Supplier.SupplierCode;
                txtContactPerson.Text   = Supplier.ContactPerson;
                txtContactPhone.Text    = Supplier.ContactPhone;
                txtDiscount.Text        = Supplier.Discount.ToString("n2");
                txtEmail.Text           = Supplier.Email;
                txtMST.Text             = Supplier.MST;
                txtName.Text            = Supplier.SupplierName;
                txtNote.Text            = Supplier.Note;
                txtOffice.Text          = Supplier.Office;
                txtPaymentTerm.Text     = Supplier.PaymentTerm;
                txtPhone.Text           = Supplier.Phone;
                txtProductProvided.Text = Supplier.ProductProvided;

                cboMaterialGroup.SelectedIndex = Supplier.MaterialGroup;
                cboStatus.SelectedIndex        = Supplier.StatusDisable;
                //cboUser.EditValue = Supplier.UserId;

                _supplierId = Supplier.SupplierId;
            }
            else
            {
                cboStatus.SelectedIndex = 0;

                DataTable dt   = LibQLSX.Select(" SELECT top 1 SupplierId ,SupplierCode FROM Suppliers where SupplierCode like 'ncc%' and SupplierCode not like '%-%' order by SupplierId desc");
                string    id   = dt.Rows[0]["SupplierId"].ToString();
                string    code = dt.Rows[0]["SupplierCode"].ToString();

                id   = id.Substring(1, id.Length - 1);
                code = code.Substring(3, code.Length - 3);

                id   = "S" + string.Format("{0:000000000}", TextUtils.ToInt(id) + 1);
                code = "NCC" + string.Format("{0:0000}", TextUtils.ToInt(code) + 1);

                txtCode.Text = code;
                _supplierId  = id;
            }
            loadUserGrid();
            loadHangGrid();
            loadContractGrid();
            loadMaterialGroupGrid();
        }
 private void loadGrid()
 {
     try
     {
         //DataTable tbl = LibQLSX.Select("Select a.*, Case when a.IsUse = 0 then N'Ngừng hoạt động' else N'Hoạt động' end StatusText from Departments a with(nolock)");
         DataTable tbl = LibQLSX.Select("Select a.* from WorkingDiariesLocation a with(nolock)");
         grdData.DataSource = tbl;
     }
     catch
     {
     }
 }
示例#6
0
 void loadYCMVT()
 {
     using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load dữ liệu..."))
     {
         string sql =
             "select distinct ProposalCode,Year,Month,UserName,OrderCode from [dbo].[vRequirePartFull_Order] " +
             " where DateAboutE is not null and DateAboutF is not null " +
             " and ProposalCode is not null and DATEDIFF(day, DateAboutE, DateAboutF) > 1";
         DataTable dt = LibQLSX.Select(sql);
         grdYC.DataSource = dt;
     }
 }
示例#7
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;
     }
 }
示例#8
0
        void loadGrid()
        {
            string sql = string.Format("select *,case when Status = 1 then cast(1 as bit) else cast(0 as bit) end as Status1, N'Báo lỗi' as Error from CriteriaImport with(nolock) where ProductPartsImportId = '{0}' and CountError = {1} order by CriteriaIndex"
                                       , ProductPartsImport.ProductPartsImportId, TextUtils.ToInt(ProductPartsImport.CountError));
            //DataTable dt = LibQLSX.Select("select *,case when Status = 1 then cast(1 as bit) else cast(0 as bit) end as Status1, N'Báo lỗi' as Error from CriteriaImport with(nolock) where ProductPartsImportId = '" + ProductPartsImport.ProductPartsImportId + "'order by CriteriaIndex");
            DataTable dt = LibQLSX.Select(sql);

            _dtTemplate = dt.Clone();
            _dtTemplate.Rows.Clear();

            grdData.DataSource = dt;
        }
示例#9
0
 void loadProject()
 {
     try
     {
         //DataTable tbl = LibQLSX.Select("exec spGetAllProject");
         DataTable tbl = LibQLSX.Select("select * from Project");
         TextUtils.PopulateCombo(cboProject, tbl, "ProjectCode", "ProjectId", "");
     }
     catch (Exception ex)
     {
     }
 }
示例#10
0
        void resetAll()
        {
            grvLink.FocusedRowHandle = -1;
            decimal totalNC = 0;
            string  sql     = "update C_QuotationDetail set TotalNC = 0 where C_QuotationID = " + C_QuotationID;

            LibQLSX.ExcuteSQL(sql);
            using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang xử lý..."))
            {
                for (int i = 0; i < grvLink.RowCount; i++)
                {
                    int id = TextUtils.ToInt(grvLink.GetRowCellValue(i, colID));
                    if (id == 0)
                    {
                        return;
                    }

                    int costID            = TextUtils.ToInt(grvLink.GetRowCellValue(i, colC_CostID));
                    int quotationDetailID = TextUtils.ToInt(grvLink.GetRowCellValue(i, colC_QuotationDetailID));
                    C_QuotationDetailModel quotationDetail = (C_QuotationDetailModel)C_QuotationDetailBO.Instance.FindByPK(quotationDetailID);
                    C_CostModel            cost            = (C_CostModel)C_CostBO.Instance.FindByPK(costID);

                    C_CostProductGroupLinkModel group = (C_CostProductGroupLinkModel)C_CostProductGroupLinkBO.Instance.FindByExpression(new Expression("C_CostID", cost.ID)
                                                                                                                                        .And(new Expression("C_ProductGroupID", quotationDetail.C_ProductGroupID)))[0];

                    decimal pricePerDay = TextUtils.ToDecimal(grvLink.GetRowCellValue(i, colPricePerDay));
                    decimal qty         = TextUtils.ToDecimal(grvLink.GetRowCellValue(i, colQty));

                    C_CostQuotationItemLinkModel link = (C_CostQuotationItemLinkModel)C_CostQuotationItemLinkBO.Instance.FindByPK(id);
                    link.PersonNumber = group.PersonNumber;// TextUtils.ToDecimal(drs[0]["PersonNumber"]);
                    if (group.IsFix == 1)
                    {
                        link.NumberDay = group.NumberDay;// TextUtils.ToDecimal(drs[0]["NumberDay"]);
                    }
                    else
                    {
                        link.NumberDay = group.VtuPercent * quotationDetail.PriceVT / cost.Price;
                    }
                    link.TotalR = link.NumberDay * link.PersonNumber;
                    if (cost.ID == 61)//phòng thiết kế
                    {
                        link.TotalR *= (1 + 0.3M * (quotationDetail.Qty - 1)) / quotationDetail.Qty;
                    }
                    link.Price = link.TotalR * cost.Price;
                    C_CostQuotationItemLinkBO.Instance.Update(link);

                    quotationDetail.TotalNC += link.Price;
                    C_QuotationDetailBO.Instance.Update(quotationDetail);
                }
                IsSaved = true;
            }
            MessageBox.Show("Reset thành công.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#11
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;
        }
示例#12
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++;
            }
        }
示例#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
        void loadProductGroup()
        {
            DataTable tbl = LibQLSX.Select(@"SELECT * FROM C_ProductGroup WITH(NOLOCK) ORDER BY Code");

            cboProductGroup.Properties.DataSource    = tbl.Copy();
            cboProductGroup.Properties.DisplayMember = "Code";
            cboProductGroup.Properties.ValueMember   = "ID";

            repositoryItemSearchLookUpEdit1.DataSource    = tbl.Copy();
            repositoryItemSearchLookUpEdit1.DisplayMember = "Code";
            repositoryItemSearchLookUpEdit1.ValueMember   = "ID";
        }
示例#15
0
        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();
            }
        }
示例#16
0
        void loadProductGroup()
        {
            DataTable dt = new DataTable();

            dt       = LibQLSX.Select("select * from vC_CostProductGroupLink where C_CostID = " + CurrentCost.ID);
            _isGroup = true;
            if (dt.Rows.Count == 0)
            {
                dt       = LibQLSX.Select("select *,ValuePercentKD = 0,ValuePercentSX = 0,NumberDay=0,PersonNumber=0,VtuPercent=0,IsFix = 0 from C_ProductGroup");
                _isGroup = false;
            }
            grdLink.DataSource = dt;
        }
示例#17
0
        void loadData()
        {
            string sql = "SELECT vRequirePartFull.*, Groups.GroupCode + ' - ' + Groups.GroupName AS GroupName"
                         + " FROM Parts LEFT OUTER JOIN"
                         + " Groups ON Parts.GroupId = Groups.GroupId RIGHT OUTER JOIN"
                         + " vRequirePartFull WITH (nolock) ON Parts.PartsCode = vRequirePartFull.PartsCode"
                         + " where SupplierCode = '" + NCCcode + "'";
            DataTable dt = LibQLSX.Select(sql);

            //DataTable dt = LibQLSX.Select("select * from vRequirePartFull with(nolock) where SupplierCode = '" + NCCcode + "'");
            //grvData.BestFitColumns();
            grdData.DataSource = dt;
        }
示例#18
0
        void loadData()
        {
            string sql = "select *,DATEDIFF(day, DateAboutE, DateCreate) as ChenhLech  from vImportMaterial a with(nolock) where Year(DateCreate) = 2016 and OrderCode is not null order by OrderCode";
            //string sql = "select *,DATEDIFF(day, DateCreate, DateCreateOrder) as ChenhLech from [dbo].[vRequirePartFull_Order] where DateAboutE is not null and ProposalCode is not null and year(DateCreate) = 2016";
            //string sql = "select * from vImportMaterial a with(nolock) where Year(DateCreate) = 2016 and (a.TotalNG = 0) AND (a.Status >= 3) ";

            //string sql = "select * from vImportMaterial a with(nolock) where Year(DateCreate) = 2016 and (a.Status >= 3) ";

            DataTable dt = LibQLSX.Select(sql);

            grdData.DataSource = dt;
            grvData.BestFitColumns();
        }
示例#19
0
 void loadProject()
 {
     try
     {
         DataTable tbl = LibQLSX.Select("exec spGetAllProject");
         //DataTable tbl = TextUtils.Select("Select ProjectId, ProjectName, ProjectCode,DateFinishE from ProjectSyn with(nolock) order by ProjectCode");
         TextUtils.PopulateCombo(cboProject, tbl, "ProjectName", "ProjectCode", "");
         cboProject.Properties.View.BestFitColumns();
     }
     catch (Exception ex)
     {
     }
 }
示例#20
0
        void loadCombo()
        {
            DataTable tbl = LibQLSX.Select(@"SELECT ID,Code,Name FROM C_CostGroup WITH(NOLOCK) ORDER BY Code");

            if (tbl == null)
            {
                return;
            }
            //TextUtils.PopulateCombo(leParentCat, tbl.Copy(), "Code", "ID", "--Cấp lớn nhất--");
            leParentCat.Properties.DataSource    = tbl;
            leParentCat.Properties.ValueMember   = "ID";
            leParentCat.Properties.DisplayMember = "Code";
        }
示例#21
0
        void loadGrid()
        {
            string sql = "select * from vProjectDirectionDetail where ProjectDirectionID = " + ProjectDirectionID;

            _dtData            = LibQLSX.Select(sql);
            grdTong.DataSource = _dtData;

            grdCNC.DataSource = LibQLSX.Select(sql + " and ProjectDirectionTypeID = 1");
            grdIN.DataSource  = LibQLSX.Select(sql + " and ProjectDirectionTypeID = 2");
            grdAL.DataSource  = LibQLSX.Select(sql + " and ProjectDirectionTypeID = 3");
            grdDT.DataSource  = LibQLSX.Select(sql + " and ProjectDirectionTypeID = 4");
            grdLR.DataSource  = LibQLSX.Select(sql + " and ProjectDirectionTypeID > 4");
        }
示例#22
0
        void loadUser()
        {
            DataTable dt = LibQLSX.Select("Select * from [vUser] WITH(NOLOCK)");

            cboUser.Properties.DataSource    = dt;
            cboUser.Properties.DisplayMember = "UserName";
            cboUser.Properties.ValueMember   = "UserId";
            grvCboUser.BestFitColumns();

            //repositoryItemSearchLookUpEdit1.DataSource = dt;
            //repositoryItemSearchLookUpEdit1.DisplayMember = "UserName";
            //repositoryItemSearchLookUpEdit1.ValueMember = "UserId";
        }
示例#23
0
        private void frmShowStaff_Load(object sender, EventArgs e)
        {
            loadStaffGroupLink();
            loadStaffGroup();
            loadCombo();
            loadGroupQLSX();

            if (Model.ID != 0)
            {
                txtBankAccount.Text         = Model.BankAccount;
                txtBHXH.Text                = Model.BHXH;
                txtBHYT.Text                = Model.BHYT;
                dtpBirthOfDate.EditValue    = Model.BirthOfDate;
                txtCMTND.Text               = Model.CMTND;
                txtCode.Text                = Model.Code;
                cboDepartment.SelectedValue = Model.DepartmentID;
                txtEmail.Text               = Model.Email;
                txtEmailCom.Text            = Model.EmailCom;
                txtFullName.Text            = Model.FullName;
                txtTelephone.Text           = Model.HandPhone;
                txtHomeAddress.Text         = Model.HomeAddress;
                txtJobDescription.Text      = Model.JobDescription;
                txtLoginName.Text           = Model.LoginName;
                txtMST.Text               = Model.MST;
                txtPasswordHash.Text      = MD5.DecryptPassword(Model.PasswordHash);
                txtPosition.Text          = Model.Position;
                txtQualifications.Text    = Model.Qualifications;
                cboSex.SelectedIndex      = Model.Sex;
                dtpStartWorking.EditValue = Model.StartWorking;
                pictureBox1.ImageLocation = Model.ImagePath;
                cboStatus.SelectedIndex   = Model.Status;
                lookUpEdit1.EditValue     = Model.UserGroupID;
                if (Model.UserGroupSXID > 0)
                {
                    cboGroup.EditValue = Model.UserGroupSXID;
                }
                else
                {
                    cboGroup.EditValue = LibQLSX.ExcuteScalar("select top 1 UserGroup1ID from Users with(nolock) where Account = '" + Model.LoginName + "'");
                }

                if (txtLoginName.Text != "")
                {
                    chkHasUser.Checked = true;
                }
            }
            else
            {
                txtPasswordHash.Text = "123456";
            }
        }
示例#24
0
        bool ValidateForm()
        {
            if (PaymentTable.ID == 0)
            {
                DataTable dt = LibQLSX.Select("select top 1 * from PaymentTable with(nolock) where Number = '" + txtNumber.Text.Trim() + "'");
                if (dt.Rows.Count > 0)
                {
                    MessageBox.Show("Bảng kê thanh toán này đã tồn tại!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return(false);
                }
            }

            return(true);
        }
示例#25
0
        void loadLeader()
        {
            try
            {
                DataTable tblPerson = LibQLSX.Select("select * from vUser with(nolock) where Code is not null order by Code");

                cboLeader.Properties.DataSource    = tblPerson;
                cboLeader.Properties.DisplayMember = "UserName";
                cboLeader.Properties.ValueMember   = "UserId";
            }
            catch
            {
            }
        }
示例#26
0
        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);
            }
        }
示例#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
 void loadProject()
 {
     try
     {
         DataTable dt = LibQLSX.Select("select * from Project with(nolock)");
         cboProject.Properties.DataSource    = dt;
         cboProject.Properties.ValueMember   = "ProjectId";
         cboProject.Properties.DisplayMember = "ProjectCode";
         //TextUtils.PopulateCombo(cboProject, tbl, "ProjectCode", "ProjectId", "");
     }
     catch (Exception ex)
     {
     }
 }
示例#29
0
        void loadCost()
        {
            DataTable dtLink = new DataTable();

            //if (CurrentQuotation.ID > 0)
            //{
            dtLink = LibQLSX.Select("select *, Price1 = (case when C_CostID in (50,12,77,78,79) then Total/dbo.IsZero(Qty,1) else Price end) from vC_CostQuotationLink where C_QuotationID = " + CurrentQuotation.ID);
            //}
            //else
            //{
            //    dtLink = LibQLSX.Select("select * from C_Cost where IsWithProject = 1 or CostType = 1");
            //}
            grdLink.DataSource = dtLink;
        }
示例#30
0
 private void frmPartsConfigLink_Load(object sender, EventArgs e)
 {
     _dtPartsGeneral = LibQLSX.Select("select *,Cast(0 as bit) as [Check] from vPartsGeneral");
     _dtListVT       = LibQLSX.Select("select [PartsId],[PartsCode],[PartsName],[Unit],ManufacturerCode from [vParts] where PartsCode is not null or PartsCode <> ''");
     loadVT();
     _dtListVT.Columns.Add("Qty", typeof(decimal));
     _dtListVT.Columns.Add("Check", typeof(bool));
     loadVT1();
     loadVTP1(_dtPartsGeneral);
     loadVTP2(_dtPartsGeneral);
     loadVTP3(_dtPartsGeneral);
     loadModule();
     loadGroupModule();
 }