예제 #1
0
파일: frmMain.cs 프로젝트: ahmadmujtaba/BMC
        private void OpenForm(string Name)
        {
            DataTable dt = new DataTable();
            bllUserSecurity ObjbllUserSecurity = new bllUserSecurity();
            dt = ObjbllUserSecurity.AllFormSecurity(GlobalVar.Type, GlobalVar.Category, Name);
            if (Convert.ToBoolean(dt.Rows[0]["CanView"]))
            {
                GlobalVar.g_Formname = Name;
                //Multiple Form Handling Coding

                if (Name == "frmGRN" || Name == "frmPurchaseOrder" || Name == "frmPurchaseInvoice")
                {
                    Name = "frmPurchaseOrder";
                }
                else if (Name == "frmPurchaseReturn" || Name == "frmDeliveryChallan")
                {
                    GlobalVar.g_Formname = Name;
                    Name = "frmPurchaseReturn";
                }
                //*********************
                bool IsOpen = false;
                foreach (Form f in Application.OpenForms)
                {
                    if (f.Name == Name)
                    {
                        IsOpen = true;
                        f.Focus();
                        f.WindowState = FormWindowState.Normal;
                        if (GlobalVar.g_Formname != Name)
                        {
                            //if (f.Text == "Goods Receipt Note")
                            //{
                            //    IsOpen = true;
                            //    f.Focus();
                            //    break;
                            //}
                            //else if (f.Text == "Purchase Invoice")
                            //{
                            //    IsOpen = true;
                            //    f.Focus();
                            //    break;
                            //}
                            //else if (f.Text == "Purchase Order")
                            //{
                            //    IsOpen = true;
                            //    f.Focus();
                            //    break;
                            //}
                            //                         else
                            //{
                            IsOpen = false;
                            //}
                        }
                        break;
                    }
                }

                if (IsOpen == false)
                {
                    var lookup = Assembly.GetExecutingAssembly().GetTypes().Select(x => x.Namespace).ToArray();
                    foreach (var item in lookup)
                    {
                        Type t = Type.GetType(item + "." + Name);
                        if (t != null)
                        {
                            DevExpress.XtraEditors.XtraForm Obj = Activator.CreateInstance(t, dt) as DevExpress.XtraEditors.XtraForm;
                            Obj.MdiParent = this;
                            Obj.WindowState = FormWindowState.Normal;
                            Obj.Show();
                            break;
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show(GlobalVar.MSG_CanView, "Babar Medicine Company Lahore - ERP", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
예제 #2
0
파일: frmMain.cs 프로젝트: ahmadmujtaba/BMC
 private void frmOpenRss_LinkClicked(object sender, NavBarLinkEventArgs e)
 {
     bool IsOpen = false;
     foreach (Form f in Application.OpenForms)
     {
         if (f.Name == "frmOpenRSS")
         {
             IsOpen = true;
             f.Focus();
             break;
         }
     }
     if (IsOpen == false)
     {
         DataTable dt = new DataTable();
         bllUserSecurity ObjbllUserSecurity = new bllUserSecurity();
         dt = ObjbllUserSecurity.AllFormSecurity(GlobalVar.Type, GlobalVar.Category, "frmOpenRssStock");
         if (Convert.ToBoolean(dt.Rows[0]["CanView"]))
         {
             frmOpenRSS frm = new frmOpenRSS(dt, "");
             frm.WindowState = FormWindowState.Normal;
             frm.Show();
         }
         else
         {
             MessageBox.Show("You are not authorized to view this form", "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }
예제 #3
0
파일: frmMain.cs 프로젝트: ahmadmujtaba/BMC
 private void frmHoldScan_LinkClicked(object sender, NavBarLinkEventArgs e)
 {
     DataTable dt = new DataTable();
     bllUserSecurity ObjbllUserSecurity = new bllUserSecurity();
     dt = ObjbllUserSecurity.AllFormSecurity(GlobalVar.Type, GlobalVar.Category, "frmHoldScan");
     if (Convert.ToBoolean(dt.Rows[0]["CanView"]))
     {
         MessageBox.Show("Please close ERP on all computers Before running Hold Scan, it will remove all hold quantities of the system", "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Information);
         DialogResult DialogResult;
         DialogResult = MessageBox.Show("Are you sure to run the Hold Scan ?", "ERP - Babar Medicine Company Lahore", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (DialogResult == DialogResult.Yes)
         {
             frmHoldScan frmObjHoldScan = new frmHoldScan();
             frmObjHoldScan.WindowState = FormWindowState.Normal;
             frmObjHoldScan.Show();
         }
     }
     else
     {
         MessageBox.Show("You are not authorized to view this form", "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
예제 #4
0
 private void simpleButton4_Click(object sender, EventArgs e)
 {
     if (txtGroupid.Text != "")
     {
         DataTable dt = new DataTable();
         bllUserSecurity ObjbllUserSecurity = new bllUserSecurity();
         dt = ObjbllUserSecurity.AllFormSecurity(GlobalVar.g_UserID, GlobalVar.Category, "frmCompanyGroup");
         if (dt.Rows.Count > 0)
         {
             if (Convert.ToBoolean(dtFormRights.Rows[0]["CanView"]))
             {
                 string GroupName = "";
                 string ID = txtGroupid.Text;
                 string GroupID = ID.Remove(3, 1);
                 GroupName = ObjbllProducts.ReturnName(GroupID, "GN");
                 if (GroupName != "")
                 {
                     frmCompanyGroup Obj = new frmCompanyGroup(GroupID, dt);
                     Obj.Visible = true;
                 }
             }
             else
             {
                 MessageBox.Show("You are not authorized to view this form", "Babar Medicine Company Lahore - ERP", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
         else
         {
             MessageBox.Show("Contact to the admin", "Babar Medicine Company Lahore - ERP", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }
예제 #5
0
 private void simpleButton5_Click(object sender, EventArgs e)
 {
     if (txtuserid.Text != "")
     {
         DataTable dtadduser = new DataTable();
         bllUserSecurity ObjbllUserSecurityadduser = new bllUserSecurity();
         dtadduser = ObjbllUserSecurityadduser.AllFormSecurity(GlobalVar.Type, GlobalVar.Category, "frmaddUsers");
         if (Convert.ToBoolean(dtadduser.Rows[0]["CanView"]))
         {
             string userid = string.Format("{0:000000}", Convert.ToInt32(txtuserid.Text));
             frmaddUsers Obj = new frmaddUsers(userid,dtadduser);
             Obj.Visible = true;
         }
         else
         {
             MessageBox.Show(GlobalVar.MSG_CanView, "Babar Medicine Company Lahore - ERP", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         MessageBox.Show("User Does Not Exist", "Babar Medicine Company Lahore - ERP", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         txtuserid.Focus();
     }
 }
예제 #6
0
        private void FormOpenFromMenuStrip(string Name)
        {
            try
            {
                DataTable dt = new DataTable();
                bllUserSecurity ObjbllUserSecurity = new bllUserSecurity();
                dt = ObjbllUserSecurity.AllFormSecurity(GlobalVar.Type, GlobalVar.Category, Name);
                //if (Convert.ToBoolean(dt.Rows[0]["CanView"]))
                //{
                GlobalVar.g_Formname = Name;
                //Multiple Form Handling Coding
                if (Name == "frmClaims" || Name == "frmCustomers" || Name == "frmLeads" || Name == "frmVendors")
                {
                    Name = "frmBusinessPartners";
                }
                bool IsOpen = false;
                foreach (Form f in from Form f in Application.OpenForms where f.Name == Name select f)
                {
                    IsOpen = true;
                    f.Focus();
                    if (GlobalVar.g_Formname != Name)
                    {
                        if (f.Text != GlobalVar.g_Formname)
                        {
                            IsOpen = false;
                        }

                    }
                    break;
                }

                if (IsOpen == false)
                {
                    var lookup = Assembly.GetExecutingAssembly().GetTypes().Select(x => x.Namespace).ToArray();
                    foreach (var item in lookup)
                    {
                        Type t = Type.GetType(item + "." + Name);
                        if (t != null)
                        {
                            XtraForm Obj = Activator.CreateInstance(t, dt) as XtraForm;
                            Obj.MdiParent = this;
                            Obj.WindowState = FormWindowState.Normal;
                            Obj.Show();
                            break;
                        }
                    }
                }
                //}
                //else
                //{
                //    MessageBox.Show(GlobalVar.MSG_CanView, "Babar Medicine Company Lahore - ERP", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //    return;
                //}
            }
            catch(Exception ex)
            {
                GlobalVar.MB(ex.Message, MessageBoxIcon.Error);
            }
        }