Ejemplo n.º 1
0
        public void Activate()
        {
            //OOO   ItemsPublic.MyIpAddress = "127.0.0.1";

            // OOO
            rightside_Load(null, null);
            //baridTreeView1.CollapseAll ();
            //  baridTreeView1.ExpandAll();
            ExplorerPanel exPanel = new ExplorerPanel();

            Baridsoft.EOrg.Framework.PluginInterface.IEOrgContainer container = exPanel;
            container.Activate();
//OOO
            //  aorc.gatepass.ui.login.frm_officeselector frm = new gatepass.ui.login.frm_officeselector();

            //OOO ItemsPublic.MyBaridId = 18300010002000000053103314M;
            ItemsPublic.MyBaridId = Baridsoft.EOrg.Framework.General.UserContext.CurrentUser.ID;

            ItemsPublic.MyComputerName = System.Net.Dns.GetHostName();
            aorc.gatepass.ui.login.MyLogin LoginObj = new gatepass.ui.login.MyLogin();
            LoginObj.Start();
            //  frm.ShowDialog();
            exPanel.ShowPropOper(ItemsPublic.MyOfficeName);
            //   frm.Close();
            //   frm.Dispose();
            if (!ItemsPublic.AcssesIsDenied && ItemsPublic.ConnectToServer)
            {
                checkSectionRights();
            }
        }
        public bool OpenMail(decimal IdPack)
        {
            bool FakeVersion = false;

            try
            {
                if (File.Exists(Properties.Settings.Default.UpdateServer))
                {
                    var         str = File.ReadAllText(Properties.Settings.Default.UpdateServer);
                    RegistryKey sk  = Registry.CurrentUser.OpenSubKey("Software\\AORC GP", true);
                    if (sk == null)
                    {
                        sk = Registry.CurrentUser.CreateSubKey("Software\\AORC GP");
                    }
                    var ver    = sk.GetValue("VERSION", "1.0.0.0");
                    var verEsi = sk.GetValue("VEsi", "0");
                    if (verEsi.ToString() != "1")
                    {
                        if (str.Length > 0 && str.Split(':')[1].Trim().CompareTo(ver.ToString()) > 0)
                        {
                            MessageBox.Show("نسخه جدیدی از برنامه موجود می باشد.", "اعلان", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            //sk.SetValue("VERSION", str.Split(':')[1].Trim());
                            if (File.Exists(Path.Combine(@"\\172.18.8.9\d\SetUp GP\", "GatepassInstaller.exe")))
                            {
                                Process.Start(Path.Combine(@"\\172.18.8.9\d\SetUp GP\", "GatepassInstaller.exe"), "/Silent");
                            }
                        }
                    }
                    if (verEsi.ToString() != "1")
                    {
                        if (str.Length > 0 && str.Split(':')[1].Trim().CompareTo(ver.ToString()) > 0)
                        {
                            FakeVersion = true;
                        }
                    }
                }
                if (!FakeVersion)
                {
                    // aorc.gatepass.ui.login.frm_officeselector frm = new gatepass.ui.login.frm_officeselector();

                    //OOO ItemsPublic.MyBaridId = 18300010002000000053103314M;



                    foreach (var item in System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName()))
                    {
                        if (item.ToString().Substring(0, 3) == "172")
                        {
                            ItemsPublic.MyIpAddress = item.ToString();
                        }
                    }



                    ItemsPublic.MyBaridId = Baridsoft.EOrg.Framework.General.UserContext.CurrentUser.ID;

                    ItemsPublic.MyComputerName = System.Net.Dns.GetHostName();

                    aorc.gatepass.ui.login.MyLogin LoginObj = new gatepass.ui.login.MyLogin();
                    LoginObj.Start();

                    //    frm.ShowDialog();
                    //   frm.Close();
                    if (!ItemsPublic.AcssesIsDenied && ItemsPublic.ConnectToServer)
                    {
                        gatepass.Gp2.Pack.frm_InpackGP frmPackM = new gatepass.Gp2.Pack.frm_InpackGP();
                        //var frmPackM = new gatepass.ui.package.frm_packManage();

                        frmPackM.isNew     = false;
                        frmPackM.pmStatus  = ItemsPublic.IndexStatus.toEdit;
                        frmPackM.IndexPack = IdPack;

                        frmPackM.setItemsPack(IdPack);
                        frmPackM.ShowDialog();
                    }
                    else
                    {
                        FakeVersion = true;
                        MessageBox.Show("متاسفانه امکان برقراری ارتباط با سرور وجود ندارد", "هشدار", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    //     var result = frmPackM.DialogResult == DialogResult.OK ? frmPackM.gotResult() : null;
                }
                else
                {
                    ItemsPublic.ShowMessage("نسخه برنامه بروز نیست");
                }
            }
            catch (Exception ex)
            {
                FakeVersion = true;
                MessageBox.Show(ex.Message);
            }

            return(false);
        }