コード例 #1
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                if (Convert.ToInt32(cmbExpLocation.SelectedValue) < 1)
                {
                    MsgBuilder theBuilder = new MsgBuilder();
                    theBuilder.DataElements["MessageText"] = "Export Location";
                    IQCareWindowMsgBox.ShowWindowConfirm("BlankDropDown", theBuilder, this);
                    return;
                }

                if (Convert.ToDateTime(dtFrmDate.Value) > Convert.ToDateTime(dtToDate.Value))
                {
                    IQCareWindowMsgBox.ShowWindow("FromDTgreaterToDate", this);
                    return;
                }
                this.Cursor = Cursors.WaitCursor;
                IImportExport theExportManager = (IImportExport)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BImportExport, BusinessProcess.FormBuilder");
                DataTable     theDT            = theExportManager.ExportIQCareDB(Convert.ToInt32(cmbExpLocation.SelectedValue), dtFrmDate.Value, dtToDate.Value);
                this.Cursor = Cursors.Default;
                Int32      theRec        = theDT.Rows.Count - 1;
                MsgBuilder theExpBuilder = new MsgBuilder();
                theExpBuilder.DataElements["Control"] = theDT.Rows[theRec][0].ToString();
                IQCareWindowMsgBox.ShowWindowConfirm("ExportSuccess", theExpBuilder, this);
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
                return;
            }
        }
コード例 #2
0
 private void btnImport_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtFileName.Text.Trim() == "")
         {
             MsgBuilder theBuilder = new MsgBuilder();
             theBuilder.DataElements["MessageText"] = "Import Database";
             IQCareWindowMsgBox.ShowWindowConfirm("BlankTextBox", theBuilder, this);
             return;
         }
         this.Cursor = Cursors.WaitCursor;
         IImportExport theImportManager = (IImportExport)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BImportExport, BusinessProcess.FormBuilder");
         theImportManager.ImportIQCareData(Convert.ToInt32(cmbImpLocation.SelectedValue), txtFileName.Text.ToString());
         this.Cursor = Cursors.Default;
         IQCareWindowMsgBox.ShowWindowConfirm("ImportDBSuccess", this);
     }
     catch (Exception err)
     {
         MsgBuilder theBuilder = new MsgBuilder();
         theBuilder.DataElements["MessageText"] = err.Message.ToString();
         IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
         return;
     }
 }
コード例 #3
0
        private void btnexport_Click(object sender, EventArgs e)
        {
            if (!fnValidate())
            {
                IQCareWindowMsgBox.ShowWindow("SelectSCMList", this);
                return;
            }
            string        dir = @"C:\SCMExport";
            IImportExport theExportManager = (IImportExport)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BImportExport, BusinessProcess.FormBuilder");
            DataSet       theDS            = theExportManager.ExportSCMIQCare();

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            else
            {
                string[] filePaths = Directory.GetFiles(@"c:\SCMExport\");
                foreach (string filePath in filePaths)
                {
                    File.Delete(filePath);
                }
            }
            theDS.WriteXml("C:\\SCMExport\\SCMMaster.xml", XmlWriteMode.WriteSchema);
            lblmessage.Text = "Exported file has saved in c:\\SCMExport\\SCMMaster.xml";
            exportItem();
            dropDBBackup();
        }
コード例 #4
0
        string GetWorkFlowXml()
        {
            List <String> points    = new List <string>();
            List <String> activitys = new List <string>();

            foreach (var v in print.Children)
            {
                IImportExport iie = v as IImportExport;
                if (null == iie)
                {
                    continue;
                }
                points.Add(iie.ExportLocation());
                if (v is IActivity)
                {
                    activitys.Add((v as IActivity).ExportControlRelationship());
                }
            }
            string _xmlValue = string.Format("<Root>\r\n{0}\r\n{1}\r\n</Root>",
                                             string.Format("<Controls Index=\"{0}\" Height=\"{1}\" Width=\"{2}\">{3}</Controls>",
                                                           Index,
                                                           this.print.Height,
                                                           this.print.Width,
                                                           string.Join("\r\n", points)),
                                             string.Format("<Relationship>{0}</Relationship>", string.Join("\r\n", activitys)));

            return(XElement.Parse(_xmlValue).ToString());
        }
コード例 #5
0
        public LibraryManager()
        {
            SongManager  = new SongManager();
            ImportExport = new XMLImportExport <Library>();

            if (File.Exists(LIBRARY_INFO_ROOT_PATH))
            {
                try
                {
                    Library = ImportExport.Import(LIBRARY_INFO_ROOT_PATH).First();
                }
                catch
                {
                    Library = new Library();
                }
            }
            else
            {
                Library = new Library();
            }
        }
コード例 #6
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            if (txtfile.Text != "")
            {
                lblmessage.Text = "";
                string strExportList = "C:\\SCMExportFile\\ExportMaster.xml";


                string myXMLfile = txtfile.Text;

                string strext = Path.GetExtension(myXMLfile);
                if (strext != ".xml")
                {
                    IQCareWindowMsgBox.ShowWindow("BrowseFile", this);
                    return;
                }
                if (myXMLfile.ToUpper() != "C:\\SCMEXPORT\\SCMMASTER.XML")
                {
                    IQCareWindowMsgBox.ShowWindow("Browswrongfile", this);
                    return;
                }

                DataSet dsExportList            = new DataSet();
                System.IO.FileStream fsReadXml1 = new System.IO.FileStream(strExportList, System.IO.FileMode.Open);
                dsExportList.ReadXml(fsReadXml1);
                fsReadXml1.Close();

                DataSet ds = new DataSet();
                System.IO.FileStream fsReadXml = new System.IO.FileStream
                                                     (myXMLfile, System.IO.FileMode.Open);


                try
                {
                    ds.ReadXml(fsReadXml);

                    //if (ds.Tables[0].Rows[0]["AppVer"].ToString() != GblIQCare.AppVersion || ((DateTime)ds.Tables[0].Rows[0]["RelDate"]).ToString("dd-MMM-yyyy") != GblIQCare.ReleaseDate)
                    //{
                    //    IQCareWindowMsgBox.ShowWindow("ImportScmMasterCheckVersion", this);
                    //    return;

                    //}
                    IImportExport theExportManager = (IImportExport)ObjectFactory.CreateInstance("BusinessProcess.FormBuilder.BImportExport, BusinessProcess.FormBuilder");
                    if (ds.Tables.Count == 21)
                    {
                        theExportManager.DBBackUpImportData();
                        foreach (DataRow r in dsExportList.Tables[0].Rows)
                        {
                            if (r["Name"].ToString() == "PharmacyMaster")
                            {
                                theExportManager.BulkInsert(ds.Tables[1], "Mst_Drug");
                                theExportManager.BulkInsert(ds.Tables[2], "Mst_Generic");
                                theExportManager.BulkInsert(ds.Tables[3], "Lnk_DrugGeneric");
                                theExportManager.BulkInsert(ds.Tables[4], "Mst_DrugType");
                                theExportManager.BulkInsert(ds.Tables[5], "Lnk_DrugTypeGeneric");
                                theExportManager.BulkInsert(ds.Tables[21], "mst_strength");
                                theExportManager.BulkInsert(ds.Tables[22], "lnk_DrugStrength");
                            }
                            if (r["Name"].ToString() == "ItemConfiguration")
                            {
                                theExportManager.ImportSCM(ds.Tables[6], "ItemConfiguration");
                            }
                            if (r["Name"].ToString() == "Manufacturerdetail")
                            {
                                theExportManager.BulkInsert(ds.Tables[7], "mst_manufacturer");
                            }
                            if (r["Name"].ToString() == "Programitemlinking")
                            {
                                theExportManager.ImportSCM(ds.Tables[8], "Programitemlinking");
                            }
                            if (r["Name"].ToString() == "Storeitemlinking")
                            {
                                theExportManager.ImportSCM(ds.Tables[9], "Storeitemlinking");
                            }
                            if (r["Name"].ToString() == "Supplieritemlinking")
                            {
                                theExportManager.ImportSCM(ds.Tables[10], "Supplieritemlinking");
                            }
                            if (r["Name"].ToString() == "Program")
                            {
                                theExportManager.BulkInsert(ds.Tables[11], "mst_program");
                            }
                            if (r["Name"].ToString() == "Donor")
                            {
                                theExportManager.BulkInsert(ds.Tables[12], "mst_donor");
                            }
                            if (r["Name"].ToString() == "Programdonorlinking")
                            {
                                theExportManager.BulkInsert(ds.Tables[13], "Lnk_DonorProgram");
                            }
                            if (r["Name"].ToString() == "Costallocationcategory")
                            {
                                theExportManager.ImportSCM(ds.Tables[14], "Costallocationcategory");
                            }
                            if (r["Name"].ToString() == "Storedetail")
                            {
                                theExportManager.BulkInsert(ds.Tables[15], "mst_store");
                            }
                            if (r["Name"].ToString() == "Storesourcedestinationlinking")
                            {
                                theExportManager.BulkInsert(ds.Tables[16], "lnk_StoreSourceDestination");
                            }
                            if (r["Name"].ToString() == "Supplier")
                            {
                                theExportManager.BulkInsert(ds.Tables[17], "mst_supplier");
                            }

                            if (r["Name"].ToString() == "Adjustmentreason")
                            {
                                theExportManager.ImportSCM(ds.Tables[18], "Adjustmentreason");
                            }
                            if (r["Name"].ToString() == "Returnreason")
                            {
                                theExportManager.ImportSCM(ds.Tables[19], "Returnreason");
                            }
                            if (r["Name"].ToString() == "Labtestlocation")
                            {
                                theExportManager.ImportSCM(ds.Tables[20], "Labtestlocation");
                            }

                            if (r["Name"].ToString() == "AddConstraint")
                            {
                                theExportManager.ImportSCM(ds.Tables[10], "AddConstraint");
                            }
                        }


                        IQCareWindowMsgBox.ShowWindow("ImportSuccess", this);
                    }
                    else
                    {
                        IQCareWindowMsgBox.ShowWindow("Browswrongfile", this);
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    fsReadXml.Close();
                }
            }
            else
            {
                IQCareWindowMsgBox.ShowWindow("BrowseFile", this);
                return;
            }
        }