示例#1
0
        private void btnKTKT_Click(object sender, EventArgs e)
        {
            string strContractDirectory = txbIDContract.Text.Replace('/', '_');

            strContractDirectory = strContractDirectory.Replace('-', '_');
            string strPODirectory = @"F:\\OPM\\" + strContractDirectory + "\\" + txbPOName.Text;

            /*Create Bao Lanh Thuc Hien Hop Dong*/
            int    ret = 0;
            string fileBBKTKTHH_temp = @"F:\LP\Bien_Ban_KTKT_HH_Template.docx";
            string strBBKTKT         = strPODirectory + "\\Biên Bản Kiểm Tra Kỹ Thuật_" + txbPOName.Text + "_" + txbIDContract.Text + ".docx";

            strBBKTKT = strBBKTKT.Replace("/", "_");
            ContractObj contractObj = new ContractObj();

            ret = ContractObj.GetObjectContract(txbIDContract.Text, ref contractObj);
            PO pO = new PO();

            ret = PO.GetObjectPO(txbPOCode.Text, ref pO);
            NTKT nTKT = new NTKT();

            nTKT.GetObjectNTKTByIDPO(txbPOCode.Text, ref nTKT);
            SiteInfo siteInfo = new SiteInfo();

            siteInfo.GetSiteInfoObject(txbIDContract.Text, ref siteInfo);
            this.Cursor = Cursors.WaitCursor;
            OpmWordHandler.Create_BBKTKT_HH(fileBBKTKTHH_temp, strBBKTKT, contractObj, pO, nTKT, siteInfo);
            this.Cursor = Cursors.Default;
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ConfirmPO newConfirmPOObj = new ConfirmPO();

            newConfirmPOObj.KHMS        = txbKHMS.Text;
            newConfirmPOObj.IDContract  = txbIDContract.Text;
            newConfirmPOObj.POID        = txbPOID.Text;
            newConfirmPOObj.PONumber    = txbPONumber.Text;
            newConfirmPOObj.ConfirmPOID = txbConfirmPOID.Text;

            newConfirmPOObj.MrPhoBan               = txbForBan.Text;
            newConfirmPOObj.MrPhoBanMobile         = txbMobileForBan.Text;
            newConfirmPOObj.MrGD_CSKH              = txbGDCSKH.Text;
            newConfirmPOObj.MrGD_CSKH_mobile       = txbMobileGDCSKH.Text;
            newConfirmPOObj.MrGD_CSKH_Landline     = txbLandLineGDCSKH.Text;
            newConfirmPOObj.MrrGD_CSKH_LandlineExt = txbExt.Text;

            int ret = 0;
            /*Create Folder NTKT*/
            string strContractDirectory = txbIDContract.Text.Replace('/', '_');

            strContractDirectory = strContractDirectory.Replace('-', '_');
            string strPODirectory = "F:\\OPM\\" + strContractDirectory + "\\" + txbPONumber.Text;

            ret = newConfirmPOObj.CheckExistConfirmPO(txbConfirmPOID.Text);
            if (0 == ret)
            {
                ret = newConfirmPOObj.InsertNewConfirmPO(newConfirmPOObj);
                if (0 == ret)
                {
                    MessageBox.Show(ConstantVar.CreateNewConfirmPOFail);
                }
                else
                {
                    MessageBox.Show(ConstantVar.CreateNewConfirmPOSuccess);
                    /*Create Bao Lanh Thuc Hien Hop Dong*/
                    string fileCVXNDH_temp = @"F:\LP\CV_XNDH_Template.docx";
                    string strCVXNDHName   = strPODirectory + "\\CV Xác Nhận Đơn Hàng_" + txbPONumber.Text + "_" + txbIDContract.Text + ".docx";
                    strCVXNDHName = strCVXNDHName.Replace("/", "_");
                    ContractObj contractObj = new ContractObj();
                    ret = ContractObj.GetObjectContract(txbIDContract.Text, ref contractObj);
                    PO pO = new PO();
                    ret         = PO.GetObjectPO(txbPOID.Text, ref pO);
                    this.Cursor = Cursors.WaitCursor;
                    OpmWordHandler.Create_VBConfirm_PO(fileCVXNDH_temp, strCVXNDHName, newConfirmPOObj, pO, contractObj);
                    this.Cursor = Cursors.Default;
                }
                /*Create File Nghiệm Thu Kỹ Thuật*/
                /*Request Update Catalog Admin*/
            }
        }
示例#3
0
        private void btnKTKT_Click(object sender, EventArgs e)
        {
            //Check và tạo forder theo mẫu
            string DriveName = "";

            DriveInfo[] driveInfos = DriveInfo.GetDrives();
            foreach (DriveInfo driveInfo in driveInfos)
            {
                //MessageBox.Show(driveInfo.Name.ToString());
                if (String.Compare(driveInfo.Name.ToString().Substring(0, 3), @"D:\") == 0 || String.Compare(driveInfo.Name.ToString().Substring(0, 3), @"E:\") == 0)
                {
                    //MessageBox.Show(driveInfo.Name.ToString().Substring(0, 1));
                    DriveName = driveInfo.Name.ToString().Substring(0, 3);
                    break;
                }
            }
            Directory.CreateDirectory(DriveName + "OPM");
            Directory.CreateDirectory(DriveName + "OPM" + txbPOName.Text);
            string strPODirectory = DriveName + "OPM\\" + txbPOName.Text;
            //string strContractDirectory = txbIDContract.Text.Replace('/', '_');
            //strContractDirectory = strContractDirectory.Replace('-', '_');
            //string strPODirectory = @"F:\\OPM\\" + strContractDirectory + "\\" + txbPOName.Text;

            /*Create Bao Lanh Thuc Hien Hop Dong*/
            int ret = 0;

            Directory.CreateDirectory(DriveName + "LP");
            string fileBBKTKTHH_temp = DriveName + @"LP\Bien_Ban_KTKT_HH_Template.docx";
            //string fileBBKTKTHH_temp = @"F:\LP\Bien_Ban_KTKT_HH_Template.docx";
            string strBBKTKT = strPODirectory + "\\Biên Bản Kiểm Tra Kỹ Thuật_" + txbPOName.Text + "_" + txbIDContract.Text + ".docx";

            strBBKTKT = strBBKTKT.Replace("/", "_");
            ContractObj contractObj = new ContractObj();

            ret = ContractObj.GetObjectContract(txbIDContract.Text, ref contractObj);
            PO pO = new PO();

            ret = PO.GetObjectPO(txbPOCode.Text, ref pO);
            NTKT nTKT = new NTKT();

            nTKT.GetObjectNTKTByIDPO(txbPOCode.Text, ref nTKT);
            SiteInfo siteInfoB = new SiteInfo();
            SiteInfo siteInfoA = new SiteInfo();

            siteInfoB.GetSiteInfoObject(txbIDContract.Text, ref siteInfoB);
            siteInfoA.GetSiteInfoA(txbIDContract.Text, ref siteInfoA);
            this.Cursor = Cursors.WaitCursor;
            OpmWordHandler.Create_BBKTKT_HH(fileBBKTKTHH_temp, strBBKTKT, contractObj, pO, nTKT, siteInfoB, siteInfoA);
            this.Cursor = Cursors.Default;
        }
示例#4
0
        public void OpenDpForm(string idPO, string idContract)
        {
            DeliverPartInforDetail deliverPartInforDetail = new DeliverPartInforDetail();
            string      contractName = null;
            PO          po           = new PO();
            int         retPo        = PO.GetObjectPO(idPO, ref po);
            ContractObj contractObj  = new ContractObj();
            int         retContract  = ContractObj.GetObjectContract(idContract, ref contractObj);

            deliverPartInforDetail.setIdPO(idPO);
            deliverPartInforDetail.setIdcontract(idContract);
            deliverPartInforDetail.setKHMS(contractObj.KHMS);
            deliverPartInforDetail.setPoname(po.PONumber);
            OpenChidForm(deliverPartInforDetail);
            return;
        }
示例#5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            NTKT newNKTTObj = new NTKT();

            newNKTTObj.KHMS                   = txbKHMS.Text;
            newNKTTObj.IDContract             = txbIDContract.Text;
            newNKTTObj.POID                   = txbPOID.Text;
            newNKTTObj.PONumber               = txbPONumber.Text;
            newNKTTObj.ID_NTKT                = txbNTKTID.Text;
            newNKTTObj.DateDuKienNTKT         = dateTimePickerNTKT.Value.ToString("yyyy-MM-dd");
            newNKTTObj.MrPhoBan               = txbForBan.Text;
            newNKTTObj.MrPhoBanMobile         = txbMobileForBan.Text;
            newNKTTObj.MrGD_CSKH              = txbGDCSKH.Text;
            newNKTTObj.MrGD_CSKH_mobile       = txbMobileGDCSKH.Text;
            newNKTTObj.MrGD_CSKH_Landline     = txbLandLineGDCSKH.Text;
            newNKTTObj.MrrGD_CSKH_LandlineExt = txbExt.Text;

            int ret = 0;
            /*Create Folder NTKT*/
            string strContractDirectory = txbIDContract.Text.Replace('/', '_');

            strContractDirectory = strContractDirectory.Replace('-', '_');
            string strPODirectory = "F:\\OPM\\" + strContractDirectory + "\\" + txbPONumber.Text;

            ret = newNKTTObj.CheckExistNTKT(txbNTKTID.Text);
            if (0 == ret)
            {
                if (!Directory.Exists(strPODirectory))
                {
                    Directory.CreateDirectory(strPODirectory);
                    MessageBox.Show("Folder " + txbPONumber.Text + " have been created!!!");
                }

                else
                {
                    MessageBox.Show("Folder " + txbPONumber.Text + " already exist!!!");
                }
                ret = newNKTTObj.InsertNewNTKT(newNKTTObj);
                if (0 == ret)
                {
                    MessageBox.Show(ConstantVar.CreateNewNTKTFail);
                }
                else
                {
                    MessageBox.Show(ConstantVar.CreateNewNTKTSuccess);
                    UpdateCatalogPanel("NTKT_" + txbNTKTID.Text);
                    /*Create Bao Lanh Thuc Hien Hop Dong*/
                    string fileRQNTKT_temp = @"F:\LP\NTKT_Request_template.docx";
                    string strRQNTKTName   = strPODirectory + "\\CV De Nghi NTKT_" + txbPONumber.Text + "_" + txbIDContract.Text + ".docx";
                    strRQNTKTName = strRQNTKTName.Replace("/", "_");
                    ContractObj contractObj = new ContractObj();
                    ret = ContractObj.GetObjectContract(txbIDContract.Text, ref contractObj);
                    PO pO = new PO();
                    ret         = PO.GetObjectPO(txbPOID.Text, ref pO);
                    this.Cursor = Cursors.WaitCursor;
                    OpmWordHandler.Create_RQNTKT_PO(fileRQNTKT_temp, strRQNTKTName, newNKTTObj, pO, contractObj);
                    this.Cursor = Cursors.Default;
                }
                /*Create File Nghiệm Thu Kỹ Thuật*/
                /*Request Update Catalog Admin*/
            }
        }
示例#6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            /*Check PO in DB*/
            int ret = 0;
            /*Save The Edited Contract Info */
            PO newPO = new PO();

            newPO.IDContract          = txbIDContract.Text;
            newPO.IDPO                = txbPOCode.Text;
            newPO.PONumber            = txbPOName.Text;
            newPO.NumberOfDevice      = float.Parse(txbNumberDevice.Text);
            newPO.DateCreatedPO       = TimePickerDateCreatedPO.Value.ToString("yyyy-MM-dd");
            newPO.DurationConfirmPO   = TimePickerDateConfirmPO.Value.ToString("yyyy-MM-dd");
            newPO.DefaultActiveDatePO = TimepickerDefaultActive.Value.ToString("yyyy-MM-dd");
            newPO.DeadLinePO          = TimePickerDeadLinePO.Value.ToString("yyyy-MM-dd");
            newPO.TotalValuePO        = float.Parse(txbValuePO.Text);
            newPO.Tupo                = float.Parse(txbTUPO.Text);
            //Check và tạo forder theo mẫu
            string DriveName = "";

            DriveInfo[] driveInfos = DriveInfo.GetDrives();
            foreach (DriveInfo driveInfo in driveInfos)
            {
                //MessageBox.Show(driveInfo.Name.ToString());
                if (String.Compare(driveInfo.Name.ToString().Substring(0, 3), @"D:\") == 0 || String.Compare(driveInfo.Name.ToString().Substring(0, 3), @"E:\") == 0)
                {
                    //MessageBox.Show(driveInfo.Name.ToString().Substring(0, 1));
                    DriveName = driveInfo.Name.ToString().Substring(0, 3);
                    break;
                }
            }
            Directory.CreateDirectory(DriveName + "OPM");
            Directory.CreateDirectory(DriveName + "OPM" + txbPOName.Text);
            string strPODirectory = DriveName + "OPM\\" + txbPOName.Text;

            /*Create Folder Contract on F Disk*/
            //string strContractDirectory = txbIDContract.Text.Replace('/', '_');
            //strContractDirectory = strContractDirectory.Replace('-', '_');
            //string strPODirectory = "F:\\OPM\\" + strContractDirectory + "\\" + txbPOName.Text;

            ret = newPO.GetDetailPO(txbPOCode.Text);
            if (0 == ret)
            {
                if (!Directory.Exists(strPODirectory))
                {
                    Directory.CreateDirectory(strPODirectory);
                    MessageBox.Show("Folder have been created!!!");
                }

                else
                {
                    MessageBox.Show("Folder already exist!!!");
                }

                ret = newPO.InsertNewPO(newPO);
                if (2 == ret)
                {
                    MessageBox.Show("Cập nhật thành công");
                }
                else
                {
                    MessageBox.Show(ConstantVar.CreateNewPOSuccess);
                    UpdateCatalogPanel(txbPOName.Text);
                    /*Create Bao Lanh Thuc Hien Hop Dong*/
                    Directory.CreateDirectory(DriveName + "LP");
                    string fileBLTUPO_temp = DriveName + @"LP\BLPO_Template.docx";
                    //string fileBLTUPO_temp = @"F:\LP\BLPO_Template.docx";
                    string strBLTUPOName = strPODirectory + "\\De nghi Bao lanh thuc hien & tam ung PO MSTT.docx";
                    /*truy Suất thông tin của Contract*/
                    ContractObj contractObj = new ContractObj();
                    ContractObj.GetObjectContract(txbIDContract.Text, ref contractObj);
                    this.Cursor = Cursors.WaitCursor;
                    OpmWordHandler.Create_BLTU_PO(fileBLTUPO_temp, strBLTUPOName, txbPOName.Text, txbIDContract.Text, contractObj.NameContract, contractObj.DateSigned, TimePickerDateCreatedPO.Value.ToString("yyyy-MM-dd"), txbValuePO.Text, txbTUPO.Text, contractObj.SiteB, TimepickerDefaultActive.Value.ToString("yyyy-MM-dd"));
                    /*Send Email To DF*/
                    string fileBLTUPO_temp1 = DriveName + @"LP\VBDNTU.docx";
                    //string fileBLTUPO_temp = @"F:\LP\BLPO_Template.docx";
                    string strBLTUPOName1 = strPODirectory + "\\Van ban de nghi tam ung.docx";
                    /*truy Suất thông tin của Contract*/
                    ContractObj contractObj1 = new ContractObj();
                    ContractObj.GetObjectContract(txbIDContract.Text, ref contractObj1);
                    this.Cursor = Cursors.WaitCursor;
                    OpmWordHandler.Create_VBTUHD(fileBLTUPO_temp1, strBLTUPOName1, txbPOName.Text, txbIDContract.Text, contractObj1.NameContract, contractObj1.DateSigned, TimePickerDateCreatedPO.Value.ToString("yyyy-MM-dd"), txbValuePO.Text, txbTUPO.Text, contractObj1.SiteB, TimepickerDefaultActive.Value.ToString("yyyy-MM-dd"));
                    /*Send Email To DF*/
                }

                /*Create Bao Lanh Thuc Hien Hop Dong*/
                //string filename = @"F:\LP\MSTT_Template.docx";
                //string strBLHPName = strContractDirectory + "\\Bao_Lanh_Hop_Dong.docx";

                //OpmWordHandler.CreateBLTH_Contract(filename, strBLHPName, tbContract.Text, tbBidName.Text, tbxDateSigned.Text, tbxSiteB.Text, txbGaranteeValue.Text, txbGaranteeActiveDate.Text);

                /*Send Email To DF*/
                //OPMEmailHandler.fSendEmail("Mail From DoanTD Gmail", strBLHPName);

                //UpdateCatalogPanel(txbPOCode.Text);
            }
            //đọc file excel--Dưỡng
            List <ListExpPO> listExpPOs = new List <ListExpPO>();

            if (txbnamefilePO.Text != null)
            {
                int retEx = OpmExcelHandler.fReadExcelFilePO(txbnamefilePO.Text, txbPOCode.Text, ref listExpPOs);
                if (retEx == 1)
                {
                    ListExpPO listExpPO = new ListExpPO();
                    int       retInsert = listExpPO.InsertMultiListPO(listExpPOs);
                    if (retInsert == 1)
                    {
                        MessageBox.Show("thông tin trong File PO đã lưu thành công");
                    }
                    else
                    {
                        MessageBox.Show("thông tin trong File PO không lưu được");
                    }
                }
                else
                {
                    MessageBox.Show("Đọc file không thành công");
                }
            }
            else
            {
                MessageBox.Show("Chưa import file Phan bo hop dong");
            }
        }
示例#7
0
文件: NTKTInfor.cs 项目: djohan89/OPM
        private void btnSave_Click(object sender, EventArgs e)
        {
            NTKT newNKTTObj = new NTKT();

            newNKTTObj.KHMS                   = txbKHMS.Text;
            newNKTTObj.IDContract             = txbIDContract.Text;
            newNKTTObj.POID                   = txbPOID.Text;
            newNKTTObj.PONumber               = txbPONumber.Text;
            newNKTTObj.ID_NTKT                = txbNTKTID.Text;
            newNKTTObj.DateDuKienNTKT         = dateTimePickerNTKT.Value.ToString("yyyy-MM-dd");
            newNKTTObj.MrPhoBan               = txbForBan.Text;
            newNKTTObj.MrPhoBanMobile         = txbMobileForBan.Text;
            newNKTTObj.MrGD_CSKH              = txbGDCSKH.Text;
            newNKTTObj.MrGD_CSKH_mobile       = txbMobileGDCSKH.Text;
            newNKTTObj.MrGD_CSKH_Landline     = txbLandLineGDCSKH.Text;
            newNKTTObj.MrrGD_CSKH_LandlineExt = txbExt.Text;
            int nod = Convert.ToInt32(txbNoD.Text);

            newNKTTObj.NumberOfDevice = (float)nod;

            int ret = 0;
            /*Create Folder NTKT*/
            //string strContractDirectory = txbIDContract.Text.Replace('/', '_');
            //strContractDirectory = strContractDirectory.Replace('-', '_');
            //string strPODirectory = "F:\\OPM\\" + strContractDirectory + "\\" + txbPONumber.Text + "\\" + "NTKT_" +txbNTKTID.Text.ToString();
            string DriveName = "";

            DriveInfo[] driveInfos = DriveInfo.GetDrives();
            foreach (DriveInfo driveInfo in driveInfos)
            {
                //MessageBox.Show(driveInfo.Name.ToString());
                if (String.Compare(driveInfo.Name.ToString().Substring(0, 3), @"D:\") == 0 || String.Compare(driveInfo.Name.ToString().Substring(0, 3), @"E:\") == 0)
                {
                    //MessageBox.Show(driveInfo.Name.ToString().Substring(0, 1));
                    DriveName = driveInfo.Name.ToString().Substring(0, 3);
                    break;
                }
            }
            Directory.CreateDirectory(DriveName + "OPM");
            Directory.CreateDirectory(DriveName + "OPM" + txbPONumber.Text);
            Directory.CreateDirectory(DriveName + "OPM" + txbPONumber.Text + "\\" + "NTKT_" + txbNTKTID.Text.ToString());
            string strPODirectory = DriveName + "OPM\\" + txbPONumber.Text + "\\" + "NTKT_" + txbNTKTID.Text.ToString();

            ret = newNKTTObj.CheckExistNTKT(txbNTKTID.Text);
            if (0 == ret)
            {
                if (!Directory.Exists(strPODirectory))
                {
                    Directory.CreateDirectory(strPODirectory);
                    MessageBox.Show("Folder " + txbPONumber.Text + " have been created!!!");
                }

                else
                {
                    MessageBox.Show("Folder " + txbPONumber.Text + " already exist!!!");
                }
                ret = newNKTTObj.InsertNewNTKT(newNKTTObj);
                if (0 == ret)
                {
                    MessageBox.Show(ConstantVar.CreateNewNTKTFail);
                }
                else
                {
                    MessageBox.Show(ConstantVar.CreateNewNTKTSuccess);
                    UpdateCatalogPanel("NTKT_" + txbNTKTID.Text);
                    /*Create Bao Lanh Thuc Hien Hop Dong*/
                    Directory.CreateDirectory(DriveName + "LP");
                    //string fileRQNTKT_temp = @"F:\LP\NTKT_Request_template.docx";
                    //string fileSofware_Certificate_Template = @"F:\LP\Sofware_Certificate_Template.docx";
                    //string fileCNCL = @"F:\LP\GIAY CHUNG NHAN CHAT LUONG_TONG_HOP_Template.docx";
                    string fileRQNTKT_temp = DriveName + @"LP\NTKT_Request_template.docx";
                    string fileSofware_Certificate_Template = DriveName + @"\LP\Sofware_Certificate_Template.docx";
                    string fileCNCL               = DriveName + @"LP\GIAY CHUNG NHAN CHAT LUONG_TONG_HOP_Template.docx";
                    string strRQNTKTName          = strPODirectory + "\\CV De Nghi NTKT_" + txbPONumber.Text + "_" + txbIDContract.Text + ".docx";
                    string strSofware_Certificate = strPODirectory + "\\Chung chi ban quyen phan mem" + txbPONumber.Text + "_" + txbIDContract.Text + ".docx";
                    string strCNCL = strPODirectory + "\\Chung nhan chat luong" + txbPONumber.Text + "_" + txbIDContract.Text + ".docx";
                    strRQNTKTName          = strRQNTKTName.Replace("/", "_");
                    strSofware_Certificate = strSofware_Certificate.Replace("/", "_");
                    strCNCL = strCNCL.Replace("/", "_");
                    ContractObj contractObj = new ContractObj();
                    int         ret0        = ContractObj.GetObjectContract(txbIDContract.Text, ref contractObj);
                    PO          pO          = new PO();
                    int         ret1        = PO.GetObjectPO(txbPOID.Text, ref pO);
                    this.Cursor = Cursors.WaitCursor;
                    NTKT nTKT = new NTKT();
                    nTKT.GetObjectNTKTByIDPO(txbPOID.Text, ref nTKT);
                    int num = Convert.ToInt32(txbNoD.Text);
                    nTKT.NumberOfDevice = (float)num;
                    float numofD = (float)num;
                    OpmWordHandler.Create_RQNTKT_PO(fileRQNTKT_temp, strRQNTKTName, nTKT, pO, contractObj);
                    OpmWordHandler.Create_Sofware_Certificate_Template(fileSofware_Certificate_Template, strSofware_Certificate, contractObj.IdContract, txbPONumber.Text, txbKHMS.Text, txbNTKTID.Text, numofD);
                    OpmWordHandler.Create_CNCL(fileCNCL, strCNCL, contractObj.IdContract, txbPONumber.Text, txbKHMS.Text, txbNTKTID.Text, numofD);
                    /////////////////////////////



                    /*Create Bao Lanh Thuc Hien Hop Dong*/
                    int    ret2 = 0;
                    string fileBBKTKTHH_temp = DriveName + @"Bien_Ban_KTKT_HH_Template.docx";
                    string strBBKTKT         = strPODirectory + "\\Biên Bản Kiểm Tra Kỹ Thuật_" + txbPONumber.Text + "_" + txbIDContract.Text + ".docx";
                    strBBKTKT = strBBKTKT.Replace("/", "_");

                    SiteInfo siteInfoB = new SiteInfo();
                    SiteInfo siteInfoA = new SiteInfo();
                    siteInfoB.GetSiteInfoObject(txbIDContract.Text, ref siteInfoB);
                    siteInfoA.GetSiteInfoA(txbIDContract.Text, ref siteInfoA);
                    this.Cursor = Cursors.WaitCursor;
                    OpmWordHandler.Create_BBKTKT_HH(fileBBKTKTHH_temp, strBBKTKT, contractObj, pO, nTKT, siteInfoB, siteInfoA);
                    this.Cursor = Cursors.Default;
                }
                /*Create File Nghiệm Thu Kỹ Thuật*/
                /*Request Update Catalog Admin*/
            }
        }
示例#8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            /*Check PO in DB*/
            int ret = 0;
            /*Save The Edited Contract Info */
            PO newPO = new PO();

            newPO.IDContract          = txbIDContract.Text;
            newPO.IDPO                = txbPOCode.Text;
            newPO.PONumber            = txbPOName.Text;
            newPO.NumberOfDevice      = float.Parse(txbNumberDevice.Text);
            newPO.DateCreatedPO       = TimePickerDateCreatedPO.Value.ToString("yyyy-MM-dd");
            newPO.DurationConfirmPO   = TimePickerDateConfirmPO.Value.ToString("yyyy-MM-dd");
            newPO.DefaultActiveDatePO = TimepickerDefaultActive.Value.ToString("yyyy-MM-dd");
            newPO.DeadLinePO          = TimePickerDeadLinePO.Value.ToString("yyyy-MM-dd");
            newPO.TotalValuePO        = float.Parse(txbValuePO.Text);

            /*Create Folder Contract on F Disk*/
            string strContractDirectory = txbIDContract.Text.Replace('/', '_');

            strContractDirectory = strContractDirectory.Replace('-', '_');
            string strPODirectory = "F:\\OPM\\" + strContractDirectory + "\\" + txbPOName.Text;

            ret = newPO.GetDetailPO(txbPOCode.Text);
            if (0 == ret)
            {
                if (!Directory.Exists(strPODirectory))
                {
                    Directory.CreateDirectory(strPODirectory);
                    MessageBox.Show("Folder have been created!!!");
                }

                else
                {
                    MessageBox.Show("Folder already exist!!!");
                }
                ret = newPO.InsertNewPO(newPO);
                if (0 == ret)
                {
                    MessageBox.Show(ConstantVar.CreateNewPOFail);
                }
                else
                {
                    MessageBox.Show(ConstantVar.CreateNewPOSuccess);
                    UpdateCatalogPanel(txbPOName.Text);
                    /*Create Bao Lanh Thuc Hien Hop Dong*/
                    string fileBLTUPO_temp = @"F:\LP\BLPO_Template.docx";
                    string strBLTUPOName   = strPODirectory + "\\De nghi Bao lanh thuc hien & tam ung PO MSTT.docx";
                    /*truy Suất thông tin của Contract*/
                    ContractObj contractObj = new ContractObj();
                    ContractObj.GetObjectContract(txbIDContract.Text, ref contractObj);
                    this.Cursor = Cursors.WaitCursor;
                    OpmWordHandler.Create_BLTU_PO(fileBLTUPO_temp, strBLTUPOName, txbPOName.Text, txbIDContract.Text, contractObj.NameContract, contractObj.DateSigned, TimePickerDateCreatedPO.Value.ToString("yyyy-MM-dd"), txbValuePO.Text, txbTUPO.Text, contractObj.SiteB, txbActiveAfter.Text);
                    /*Send Email To DF*/

                    OPMEmailHandler.fSendEmail("Mail From DoanTD Gmail", strBLTUPOName);
                    this.Cursor = Cursors.Default;
                }

                /*Create Bao Lanh Thuc Hien Hop Dong*/
                //string filename = @"F:\LP\MSTT_Template.docx";
                //string strBLHPName = strContractDirectory + "\\Bao_Lanh_Hop_Dong.docx";

                //OpmWordHandler.CreateBLTH_Contract(filename, strBLHPName, tbContract.Text, tbBidName.Text, tbxDateSigned.Text, tbxSiteB.Text, txbGaranteeValue.Text, txbGaranteeActiveDate.Text);

                /*Send Email To DF*/
                //OPMEmailHandler.fSendEmail("Mail From DoanTD Gmail", strBLHPName);

                //UpdateCatalogPanel(txbPOCode.Text);
            }
        }