Exemplo n.º 1
0
        public void SetValueItemForm(string idContract)
        {
            //Add New Comment+ Edit From local
            //Add New Comment Level2+ Edit From Local Lan 2+Change Local Lan 2
            ContractObj contract = new ContractObj();

            contract.GetDisplayContract(idContract, ref contract);
            this.txbKHMS.Text                        = contract.KHMS;
            this.tbContract.Text                     = contract.IdContract;
            this.tbBidName.Text                      = contract.NameContract;
            this.tbAccountingCode.Text               = contract.CodeAccounting;
            dateTimePickerDateSignedPO.Value         = Convert.ToDateTime(contract.DateSigned.ToString());
            dateTimePickerDurationDateContract.Value = dateTimePickerDateSignedPO.Value.AddDays(Convert.ToInt32(contract.DurationContract));
            this.txbTypeContract.Text                = contract.TypeContract;
            this.tbxDurationContract.Text            = contract.DurationContract;
            dateTimePickerActiveDateContract.Value   = Convert.ToDateTime(contract.ActiveDateContract.ToString());
            this.tbxValueContract.Text               = contract.ValueContract;
            this.tbxDurationPO.Text                  = contract.DurationGuranteePO;
            this.tbxSiteA.Text                       = contract.SiteA;
            this.tbxSiteB.Text                       = contract.SiteB;
            this.ExpirationDate.Value                = Convert.ToDateTime(contract.ExperationDate.ToString());
            State(true);

            return;
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
        public static void Create_BBKTKT_HH(object filename, object SaveAs, ContractObj contractObject, PO objPO, NTKT nTKT, SiteInfo siteInfo)
        {
            WordOffice.Application wordApp = new WordOffice.Application();
            object missing = Missing.Value;

            WordOffice.Document myWordDoc = null;

            if (File.Exists((string)filename))
            {
                object readOnly  = false;
                object isVisible = false;
                wordApp.Visible = false;

                myWordDoc = wordApp.Documents.Open(ref filename, ref missing, ref readOnly,
                                                   ref missing, ref missing, ref missing,
                                                   ref missing, ref missing, ref missing,
                                                   ref missing, ref missing, ref missing,
                                                   ref missing, ref missing, ref missing, ref missing);
                myWordDoc.Activate();

                //find and replace
                FindAndReplace(wordApp, "<PO_Number>", " " + objPO.PONumber + " ");
                FindAndReplace(wordApp, "<PO_ID>", " " + objPO.IDPO + " ");
                FindAndReplace(wordApp, "<PO_CreatedDate>", " " + objPO.DateCreatedPO + " ");
                FindAndReplace(wordApp, "<XNDH_ID>", " " + objPO.IDPO + " ");
                FindAndReplace(wordApp, "<XNDH_CreatedDate>", " " + objPO.DefaultActiveDatePO + " ");
                FindAndReplace(wordApp, "<NTKT_ID>", " " + nTKT.ID_NTKT + " ");
                FindAndReplace(wordApp, "<NTKT_CreatedDate>", " " + nTKT.getCreateDate + " ");
                FindAndReplace(wordApp, "<DC>", " " + objPO.NumberOfDevice + " ");
                FindAndReplace(wordApp, "<PDC>", " " + (Math.Round((objPO.NumberOfDevice) * 0.02)) + " ");
                FindAndReplace(wordApp, "<DateNow>", " " + DateTime.Now.ToString("dd/MM/yyyy") + " ");

                FindAndReplace(wordApp, "<Contract_ID>", " " + contractObject.IdContract + " ");
                FindAndReplace(wordApp, "<Contract_Name>", " " + contractObject.NameContract + " ");
                FindAndReplace(wordApp, "<KHMS>", " " + contractObject.KHMS + " ");
                FindAndReplace(wordApp, "<Contract_DateSigned>", " " + contractObject.DateSigned + " ");
                FindAndReplace(wordApp, "<Site_B>", " " + contractObject.SiteB + " ");

                FindAndReplace(wordApp, "<Address_Site_B>", " " + siteInfo.Address + " ");
                FindAndReplace(wordApp, "<LandLine_Site_B>", " " + siteInfo.Phonenumber + " ");
                FindAndReplace(wordApp, "<Fax_Site_B>", " " + siteInfo.Tin + " ");
            }
            else
            {
                MessageBox.Show("File not Found!");
            }

            //Save as
            myWordDoc.SaveAs2(ref SaveAs, ref missing, ref missing, ref missing,
                              ref missing, ref missing, ref missing,
                              ref missing, ref missing, ref missing,
                              ref missing, ref missing, ref missing,
                              ref missing, ref missing, ref missing);

            myWordDoc.Close();
            wordApp.Quit();
            MessageBox.Show("File Biên Bản Kiểm Tra Kĩ Thuật Hàng Hóa Được Tạo");
        }
Exemplo n.º 4
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*/
            }
        }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
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;
        }
Exemplo n.º 7
0
        public static void Create_VBConfirm_PO(object filename, object SaveAs, ConfirmPO confirmPO, PO objPO, ContractObj contractObj)
        {
            WordOffice.Application wordApp = new WordOffice.Application();
            object missing = Missing.Value;

            WordOffice.Document myWordDoc = null;

            if (File.Exists((string)filename))
            {
                object readOnly  = false;
                object isVisible = false;
                wordApp.Visible = false;

                myWordDoc = wordApp.Documents.Open(ref filename, ref missing, ref readOnly,
                                                   ref missing, ref missing, ref missing,
                                                   ref missing, ref missing, ref missing,
                                                   ref missing, ref missing, ref missing,
                                                   ref missing, ref missing, ref missing, ref missing);
                myWordDoc.Activate();

                //find and replace
                FindAndReplace(wordApp, "<dd>", " " + DateTime.Now.ToString("dd") + " ");
                FindAndReplace(wordApp, "<MM>", " " + DateTime.Now.ToString("MM") + " ");
                FindAndReplace(wordApp, "<yyyy>", " " + DateTime.Now.ToString("yyyy") + " ");

                FindAndReplace(wordApp, "<XNDH_ID>", " " + confirmPO.ConfirmPOID + " ");
                FindAndReplace(wordApp, "<DateNow>", " " + DateTime.Now.ToString("dd/MM/yyyy") + " ");


                FindAndReplace(wordApp, "<PO_Number>", " " + confirmPO.PONumber + " ");
                FindAndReplace(wordApp, "<PO_ID>", " " + confirmPO.POID + " ");
                FindAndReplace(wordApp, "<PO_DateCreated>", " " + objPO.DateCreatedPO + " ");

                FindAndReplace(wordApp, "<KHMS>", " " + confirmPO.KHMS + " ");
                FindAndReplace(wordApp, "<Contract_ID>", " " + confirmPO.IDContract + " ");
                FindAndReplace(wordApp, "<Contract_Name>", " " + contractObj.NameContract + " ");
                FindAndReplace(wordApp, "<Contract_DateSigned>", " " + contractObj.DateSigned + " ");
                FindAndReplace(wordApp, "<Site_B>", " " + contractObj.SiteB + " ");

                FindAndReplace(wordApp, "<MrPhoBan>", " " + confirmPO.MrPhoBan + " ");
                FindAndReplace(wordApp, "<Mobile>", " " + confirmPO.MrPhoBanMobile + " ");

                FindAndReplace(wordApp, "<MrGDCSKH>", " " + confirmPO.MrGD_CSKH + " ");
                FindAndReplace(wordApp, "<MrGDMobile>", " " + confirmPO.MrGD_CSKH_mobile + " ");

                FindAndReplace(wordApp, "<LandLine>", " " + confirmPO.MrGD_CSKH_Landline + " ");
                FindAndReplace(wordApp, "<Ext>", " " + confirmPO.MrrGD_CSKH_LandlineExt + " ");
            }
            else
            {
                MessageBox.Show("File Xác Nhận Đơn Hàng Not Found!");
            }

            //Save as
            myWordDoc.SaveAs2(ref SaveAs, ref missing, ref missing, ref missing,
                              ref missing, ref missing, ref missing,
                              ref missing, ref missing, ref missing,
                              ref missing, ref missing, ref missing,
                              ref missing, ref missing, ref missing);

            myWordDoc.Close();
            wordApp.Quit();
            MessageBox.Show("File Xác Nhận Đơn Hàng Đã Được Created!");
        }
Exemplo n.º 8
0
        public static void Create_RQNTKT_PO(object filename, object SaveAs, NTKT nTKT, PO objPO, ContractObj contractObj)
        {
            WordOffice.Application wordApp = new WordOffice.Application();
            object missing = Missing.Value;

            WordOffice.Document myWordDoc = null;

            if (File.Exists((string)filename))
            {
                object readOnly  = false;
                object isVisible = false;
                wordApp.Visible = false;

                myWordDoc = wordApp.Documents.Open(ref filename, ref missing, ref readOnly,
                                                   ref missing, ref missing, ref missing,
                                                   ref missing, ref missing, ref missing,
                                                   ref missing, ref missing, ref missing,
                                                   ref missing, ref missing, ref missing, ref missing);
                myWordDoc.Activate();

                //find and replace
                FindAndReplace(wordApp, "<dd>", " " + DateTime.Now.ToString("dd") + " ");
                FindAndReplace(wordApp, "<MM>", " " + DateTime.Now.ToString("MM") + " ");
                FindAndReplace(wordApp, "<yyyy>", " " + DateTime.Now.ToString("yyyy") + " ");

                FindAndReplace(wordApp, "<NTKT_ID>", " " + nTKT.ID_NTKT + " ");
                FindAndReplace(wordApp, "<Date_NTKT_DuKien>", " " + nTKT.DateDuKienNTKT + " ");

                FindAndReplace(wordApp, "<PO_Number>", " " + nTKT.PONumber + " ");
                FindAndReplace(wordApp, "<PO_ID>", " " + nTKT.POID + " ");
                FindAndReplace(wordApp, "<Created_DatePO>", " " + objPO.DateCreatedPO + " ");

                FindAndReplace(wordApp, "<KHMS>", " " + nTKT.KHMS + " ");
                FindAndReplace(wordApp, "<Contract_ID>", " " + nTKT.IDContract + " ");
                FindAndReplace(wordApp, "<Contract_Name>", " " + contractObj.NameContract + " ");
                FindAndReplace(wordApp, "<SignedDate_Contract>", " " + contractObj.DateSigned + " ");
                FindAndReplace(wordApp, "<Site_B>", " " + contractObj.SiteB + " ");

                FindAndReplace(wordApp, "<Mr_PhoBan>", " " + nTKT.MrPhoBan + " ");
                FindAndReplace(wordApp, "<Mobile>", " " + nTKT.MrPhoBanMobile + " ");

                FindAndReplace(wordApp, "<Mr_GD_HTKT_CSKH>", " " + nTKT.MrGD_CSKH + " ");
                FindAndReplace(wordApp, "<Mr_GD_Mobile>", " " + nTKT.MrGD_CSKH_mobile + " ");

                FindAndReplace(wordApp, "<MrGDLandLine>", " " + nTKT.MrGD_CSKH_Landline + " ");
                FindAndReplace(wordApp, "<Ext>", " " + nTKT.MrrGD_CSKH_LandlineExt + " ");
            }
            else
            {
                MessageBox.Show("File not Found!");
            }

            //Save as
            myWordDoc.SaveAs2(ref SaveAs, ref missing, ref missing, ref missing,
                              ref missing, ref missing, ref missing,
                              ref missing, ref missing, ref missing,
                              ref missing, ref missing, ref missing,
                              ref missing, ref missing, ref missing);

            myWordDoc.Close();
            wordApp.Quit();
            MessageBox.Show("File Yêu Cầu Nghiệm Thu Kỹ Thuật Đã Được Created!");
        }
Exemplo n.º 9
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*/
            }
        }
Exemplo n.º 10
0
        public static void Create_BBKTKT_HH(object filename, object SaveAs, ContractObj contractObject, PO objPO, NTKT nTKT, SiteInfo siteInfo, SiteInfo siteInfoA)
        {
            WordOffice.Application wordApp = new WordOffice.Application();
            object missing = Missing.Value;

            WordOffice.Document myWordDoc = null;

            try
            {
                if (File.Exists((string)filename))
                {
                    object readOnly  = false;
                    object isVisible = false;
                    wordApp.Visible = false;

                    myWordDoc = wordApp.Documents.Open(ref filename, ref missing, ref readOnly,
                                                       ref missing, ref missing, ref missing,
                                                       ref missing, ref missing, ref missing,
                                                       ref missing, ref missing, ref missing,
                                                       ref missing, ref missing, ref missing, ref missing);
                    myWordDoc.Activate();

                    //find and replace
                    FindAndReplace(wordApp, "<PO_Number>", " " + objPO.PONumber + " ");
                    FindAndReplace(wordApp, "<PO_ID>", " " + objPO.IDPO + " ");
                    string[] PO_CreatedDate = convertDateFormat.ConvertFormatDate(objPO.DateCreatedPO, "yyyy-MM-dd", "dd/MM/yyyy");
                    FindAndReplace(wordApp, "<PO_CreatedDate>", " " + PO_CreatedDate[0] + "/" + PO_CreatedDate[1] + "/" + PO_CreatedDate[2]);
                    FindAndReplace(wordApp, "<XNDH_ID>", " " + objPO.IDPO + " ");
                    string[] XNDH_CreatedDate = convertDateFormat.ConvertFormatDate(objPO.DefaultActiveDatePO, "yyyy-MM-dd", "dd/MM/yyyy");
                    FindAndReplace(wordApp, "<XNDH_CreatedDate>", " " + XNDH_CreatedDate[0] + "/" + XNDH_CreatedDate[1] + "/" + XNDH_CreatedDate[2]);
                    FindAndReplace(wordApp, "<NTKT_ID>", " " + nTKT.ID_NTKT + " ");
                    string[] NTKT_CreatedDate = convertDateFormat.ConvertFormatDate(nTKT.getCreateDate, "yyyy-MM-dd", "dd/MM/yyyy");
                    FindAndReplace(wordApp, "<NTKT_CreatedDate>", " " + NTKT_CreatedDate[0] + "/" + NTKT_CreatedDate[1] + "/" + NTKT_CreatedDate[2]);
                    FindAndReplace(wordApp, "<DC>", " " + (Math.Round(nTKT.NumberOfDevice - (nTKT.NumberOfDevice) * 0.02)) + " ");
                    FindAndReplace(wordApp, "<PDC>", " " + (Math.Round((nTKT.NumberOfDevice) * 0.02)) + " ");
                    string[] dateNow = convertDateFormat.ConvertFormatDate(DateTime.Now.ToString("dd-MM-yyyy"), "dd-MM-yyyy", "dd/MM/yyyy");
                    FindAndReplace(wordApp, "<DateNow>", " " + dateNow[0] + "/" + dateNow[1] + "/" + dateNow[2]);

                    FindAndReplace(wordApp, "<Contract_ID>", " " + contractObject.IdContract + " ");
                    FindAndReplace(wordApp, "<Contract_Name>", " " + contractObject.NameContract + " ");
                    FindAndReplace(wordApp, "<KHMS>", " " + contractObject.KHMS + " ");
                    string[] Contract_DateSigned = convertDateFormat.ConvertFormatDate(contractObject.DateSigned, "dd-MM-yyyy", "dd/MM/yyyy");
                    FindAndReplace(wordApp, "<Contract_DateSigned>", " " + Contract_DateSigned[0] + "/" + Contract_DateSigned[1] + "/" + Contract_DateSigned[2]);
                    FindAndReplace(wordApp, "<Site_B>", " " + contractObject.SiteB + " ");

                    FindAndReplace(wordApp, "<Address_Site_B>", " " + siteInfo.Address + " ");
                    FindAndReplace(wordApp, "<LandLine_Site_B>", " " + siteInfo.Phonenumber + " ");
                    FindAndReplace(wordApp, "<Fax_Site_B>", " " + siteInfo.Tin + " ");

                    FindAndReplace(wordApp, "<LandLine_Site_A>", " " + siteInfoA.Phonenumber + " ");
                    FindAndReplace(wordApp, "<Fax_Site_A>", " " + siteInfoA.Tin + " ");
                }
                else
                {
                    MessageBox.Show("File not Found!");
                }

                //Save as
                myWordDoc.SaveAs2(ref SaveAs, ref missing, ref missing, ref missing,
                                  ref missing, ref missing, ref missing,
                                  ref missing, ref missing, ref missing,
                                  ref missing, ref missing, ref missing,
                                  ref missing, ref missing, ref missing);

                myWordDoc.Close();
                wordApp.Quit();
                MessageBox.Show("File Biên Bản Kiểm Tra Kĩ Thuật Hàng Hóa Được Tạo");
            }
            catch (Exception)
            {
                myWordDoc.Close();
                wordApp.Quit();
                MessageBox.Show("File Biên Bản Kiểm Tra Kĩ Thuật Hàng Hóa không Tạo thành công");
            }
        }
Exemplo n.º 11
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");
            }
        }
Exemplo n.º 12
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 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*/
            }
        }
Exemplo n.º 13
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);
            }
        }