Exemplo n.º 1
0
        public void LoadMasters()
        {
            try
            {
                menuStrip.Invoke(new Action(() => menuStrip.Enabled = false));
                lblInfo.Invoke(new Action(() => lblInfo.Text        = "Please wait.."));
                using (var purelifeErpClient = new PurelifeErpClient.PurelifeErpClient())
                {
                    Common.Masters.AccountGroup          = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.AccountGroup);
                    Common.Masters.ItemGroup             = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.ItemGroup);
                    Common.Masters.SaleOrderReceivgEntry = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.Account);
                    Common.Masters.SaleOrderReceivgEntry = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.SaleOrderReceivingEntryDET);
                    Common.Masters.ItemDesc = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.ItemDescp);
                    Common.Masters.UMO      = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.UMO);

                    Common.Masters.Department   = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.Dept);
                    Common.Masters.Designation  = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.Desig);
                    Common.Masters.SoftwareRole = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.SoftwareRole);
                    Common.Masters.Location     = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.Location);
                    Common.Masters.IssueTo      = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.MSTIssueMaster);

                    DataTable dt     = purelifeErpClient.MastersListing(PurelifeErpClient.PageName.Account);
                    DataTable dtTemp = new DataTable();
                    dtTemp.Columns.Add("Code");
                    dtTemp.Columns.Add("Value");
                    dtTemp.Columns.Add("AccType");
                    DataRow[] s   = null;
                    DataRow   row = dtTemp.NewRow();
                    s = dt.Select("AccType=4");
                    foreach (DataRow item in s)
                    {
                        DataRow dr = dtTemp.NewRow();
                        dr["Code"]    = item["Code"];
                        dr["Value"]   = item["Value"];
                        dr["AccType"] = item["AccType"];
                        dtTemp.Rows.Add(dr);
                    }
                    //dtTemp.Rows.Add(dt.Select("AccType=4"));
                    Common.Masters.AccountType = dtTemp;

                    purelifeErpClient.Close();
                }

                lblInfo.Invoke(new Action(() => lblInfo.Text        = ""));
                menuStrip.Invoke(new Action(() => menuStrip.Enabled = true));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }