void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            string username = "******";
            string password = "******";

            if(e.Argument.ToString()=="DS")
            {
                int? dUpdateStatus = DirectoryUpdateStatus.GetLastVersion("All");

                try
                {

                    HCMIS.Desktop.DirectoryServices.Service1SoapClient sc = new HCMIS.Desktop.DirectoryServices.Service1SoapClient();

                    long newLastVersionDS = sc.GetLastVersion(username, password);

                    if (!dUpdateStatus.HasValue || dUpdateStatus.Value != newLastVersionDS)
                    {
                        //Proxy.ABC.SaveList(sc.GetABCs(username, password, dUpdateStatus, null));
                        //Proxy.VEN.SaveList(sc.GetVENs(username, password, dUpdateStatus, null));
                        //Proxy.CommodityType.SaveList(sc.GetCommodityTypes(username, password, dUpdateStatus, null));
                        //Proxy.DosageForm.SaveList(sc.GetDosageForms(username, password, dUpdateStatus, null));
                        //Proxy.Product.SaveList(sc.GetProducts(username, password, dUpdateStatus, null));
                        //Proxy.Unit.SaveList(sc.GetUnits(username, password, dUpdateStatus, null));
                        //Proxy.Program.SaveList(sc.GetPrograms(username, password, dUpdateStatus, null));
                        //Proxy.Manufacturer.SaveList(sc.GetManufacturer(username, password, dUpdateStatus, null));
                        //Proxy.Supplier.SaveList(sc.GetSuppliers(username, password, dUpdateStatus, null));
                        //Proxy.StoreType.SaveList(sc.GetModes(username, password, dUpdateStatus, null));
                        //Proxy.StoreGroup.SaveList(sc.GetAccounts(username, password, dUpdateStatus, null));
                        //Proxy.StoreGroupDivision.SaveList(sc.GetSubAccounts(username, password, dUpdateStatus, null));
                        //Proxy.Stores.SaveList(sc.GetSubSubAccounts(username, password, dUpdateStatus, null));
                        //Proxy.ItemUnit.SaveList(sc.GetItemUnitsWithUnitDetail(username, password, dUpdateStatus, null));
                        //Proxy.Items.SaveList(sc.GetDrugItems(username, password, dUpdateStatus, null));
                        //Proxy.Items.SaveList(sc.GetSupplyItems(username, password, dUpdateStatus, null));
                        //Proxy.DrugCategory.SaveList(sc.GetDrugCategory(username, password, dUpdateStatus, null));
                        //Proxy.DrugSubCategory.SaveList(sc.GetDrugSubCategory(username, password, dUpdateStatus, null));
                        //Proxy.SupplyCategory.SaveList(sc.GetSupplyCategories(username, password, dUpdateStatus, null));
                        //Proxy.ItemSupplyCategory.SaveList(sc.GetItemSupplyCategories(username, password, dUpdateStatus, null));
                        //Proxy.DrugItemSubCategory.SaveList(sc.GetDrugItemSubCategory(username, password, dUpdateStatus, null));
                        ////Proxy.ItemProgram.SaveList(sc.GetItemPrograms(username, password, dUpdateStatus, null));
                        //Proxy.ItemUnit.SaveList(sc.GetItemUnitsWithUnitDetail(username, password, dUpdateStatus, null));
                        //Proxy.ItemManufacturer.SaveList(sc.GetItemManufacturers(username, password, dUpdateStatus, null));
                        DirectoryUpdateStatus.SaveLastVersion("All", Convert.ToInt32(newLastVersionDS));
                    }
                }
                catch (Exception exp)
                {
                    string message = "";

                    if (CurrentContext.LoggedInUser.UserType == UserType.Constants.SUPER_ADMINISTRATOR)
                    {
                        message = exp.Message;
                    }
                    else
                    {
                        message = "Please check the network connection and try again.";
                    }
                    e.Result = message;
                }
            }

            else if(e.Argument.ToString()=="GL")
            {
                int? gLUpdateStatus = DirectoryUpdateStatus.GetLastVersion("GL");
                try
                {
                    HCMIS.Desktop.GeneralLookups.Service1SoapClient glSC = new Service1SoapClient();
                    long newLastVersionGL = glSC.GetLastVersion(username, password);
                    if (!gLUpdateStatus.HasValue || gLUpdateStatus.Value != newLastVersionGL)
                    {
                        //Proxy.Region.SaveList(glSC.GetRegions(username, password, gLUpdateStatus, null));
                        //Proxy.Zone.SaveList(glSC.GetZones(username, password, gLUpdateStatus, null));
                        //Proxy.Woreda.SaveList(glSC.GetWoredas(username, password, gLUpdateStatus, null));
                        DirectoryUpdateStatus.SaveLastVersion("GL", Convert.ToInt32(newLastVersionGL));
                    }
                }
                catch (Exception exp)
                {
                    string message = "";

                    if (CurrentContext.LoggedInUser.UserType == UserType.Constants.SUPER_ADMINISTRATOR)
                    {
                        message = exp.Message;
                    }
                    else
                    {
                        message = "Please check the network connection and try again.";
                    }
                    e.Result = message;
                }
            }
        }
Example #2
0
        void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            string username = "******";
            string password = "******";

            if (e.Argument.ToString() == "DS")
            {
                int?dUpdateStatus = DirectoryUpdateStatus.GetLastVersion("All");

                try
                {
                    HCMIS.Desktop.DirectoryServices.Service1SoapClient sc = new HCMIS.Desktop.DirectoryServices.Service1SoapClient();

                    long newLastVersionDS = sc.GetLastVersion(username, password);

                    if (!dUpdateStatus.HasValue || dUpdateStatus.Value != newLastVersionDS)
                    {
                        //Proxy.ABC.SaveList(sc.GetABCs(username, password, dUpdateStatus, null));
                        //Proxy.VEN.SaveList(sc.GetVENs(username, password, dUpdateStatus, null));
                        //Proxy.CommodityType.SaveList(sc.GetCommodityTypes(username, password, dUpdateStatus, null));
                        //Proxy.DosageForm.SaveList(sc.GetDosageForms(username, password, dUpdateStatus, null));
                        //Proxy.Product.SaveList(sc.GetProducts(username, password, dUpdateStatus, null));
                        //Proxy.Unit.SaveList(sc.GetUnits(username, password, dUpdateStatus, null));
                        //Proxy.Program.SaveList(sc.GetPrograms(username, password, dUpdateStatus, null));
                        //Proxy.Manufacturer.SaveList(sc.GetManufacturer(username, password, dUpdateStatus, null));
                        //Proxy.Supplier.SaveList(sc.GetSuppliers(username, password, dUpdateStatus, null));
                        //Proxy.StoreType.SaveList(sc.GetModes(username, password, dUpdateStatus, null));
                        //Proxy.StoreGroup.SaveList(sc.GetAccounts(username, password, dUpdateStatus, null));
                        //Proxy.StoreGroupDivision.SaveList(sc.GetSubAccounts(username, password, dUpdateStatus, null));
                        //Proxy.Stores.SaveList(sc.GetSubSubAccounts(username, password, dUpdateStatus, null));
                        //Proxy.ItemUnit.SaveList(sc.GetItemUnitsWithUnitDetail(username, password, dUpdateStatus, null));
                        //Proxy.Items.SaveList(sc.GetDrugItems(username, password, dUpdateStatus, null));
                        //Proxy.Items.SaveList(sc.GetSupplyItems(username, password, dUpdateStatus, null));
                        //Proxy.DrugCategory.SaveList(sc.GetDrugCategory(username, password, dUpdateStatus, null));
                        //Proxy.DrugSubCategory.SaveList(sc.GetDrugSubCategory(username, password, dUpdateStatus, null));
                        //Proxy.SupplyCategory.SaveList(sc.GetSupplyCategories(username, password, dUpdateStatus, null));
                        //Proxy.ItemSupplyCategory.SaveList(sc.GetItemSupplyCategories(username, password, dUpdateStatus, null));
                        //Proxy.DrugItemSubCategory.SaveList(sc.GetDrugItemSubCategory(username, password, dUpdateStatus, null));
                        ////Proxy.ItemProgram.SaveList(sc.GetItemPrograms(username, password, dUpdateStatus, null));
                        //Proxy.ItemUnit.SaveList(sc.GetItemUnitsWithUnitDetail(username, password, dUpdateStatus, null));
                        //Proxy.ItemManufacturer.SaveList(sc.GetItemManufacturers(username, password, dUpdateStatus, null));
                        DirectoryUpdateStatus.SaveLastVersion("All", Convert.ToInt32(newLastVersionDS));
                    }
                }
                catch (Exception exp)
                {
                    string message = "";

                    if (CurrentContext.LoggedInUser.UserType == UserType.Constants.SUPER_ADMINISTRATOR)
                    {
                        message = exp.Message;
                    }
                    else
                    {
                        message = "Please check the network connection and try again.";
                    }
                    e.Result = message;
                }
            }

            else if (e.Argument.ToString() == "GL")
            {
                int?gLUpdateStatus = DirectoryUpdateStatus.GetLastVersion("GL");
                try
                {
                    HCMIS.Desktop.GeneralLookups.Service1SoapClient glSC = new Service1SoapClient();
                    long newLastVersionGL = glSC.GetLastVersion(username, password);
                    if (!gLUpdateStatus.HasValue || gLUpdateStatus.Value != newLastVersionGL)
                    {
                        //Proxy.Region.SaveList(glSC.GetRegions(username, password, gLUpdateStatus, null));
                        //Proxy.Zone.SaveList(glSC.GetZones(username, password, gLUpdateStatus, null));
                        //Proxy.Woreda.SaveList(glSC.GetWoredas(username, password, gLUpdateStatus, null));
                        DirectoryUpdateStatus.SaveLastVersion("GL", Convert.ToInt32(newLastVersionGL));
                    }
                }
                catch (Exception exp)
                {
                    string message = "";

                    if (CurrentContext.LoggedInUser.UserType == UserType.Constants.SUPER_ADMINISTRATOR)
                    {
                        message = exp.Message;
                    }
                    else
                    {
                        message = "Please check the network connection and try again.";
                    }
                    e.Result = message;
                }
            }
        }