示例#1
0
 public frm_Add(int permissions, string table)
 {
     this.permissions = permissions;
     this.table = table;
     dbh = new SQLDatabaseHandler();
     InitializeComponent();
 }
 //Custom contructor
 public frm_Edit(int permissions, string table, int id)
 {
     this.permissions = permissions;
     this.table = table;
     this.id = id;
     
     InitializeComponent();
     dbh = new SQLDatabaseHandler();
 }
示例#3
0
 public frm_Add()
 {
     InitializeComponent();
     dbh = new SQLDatabaseHandler();
     sqlCmd = new SqlCommand("Select top 1* from Tbl_Customer", dbh.GetCon());
     SqlDataReader sqlDR = sqlCmd.ExecuteReader();
     columns = new List<string>();
     for (int i = 1; i < sqlDR.FieldCount; i++)
     {
         columns.Add(sqlDR.GetName(i));
     }
     sqlDR.Close();
 }
 public frm_Login()
 {
     InitializeComponent();
     dbh = new SQLDatabaseHandler();
 }
示例#5
0
 public frm_Add(int permissions)
 {
     this.permissions = permissions;
     dbh = new SQLDatabaseHandler();
     InitializeComponent();
 }
        public frm_Show(string query, int permissions, string department)
        {
            this.query = query;
            this.permissions = permissions;
            this.department = department;
            dbh = new SQLDatabaseHandler();
            InitializeComponent();

            #region IfAdmin
            if (permissions == 1)
            {
                btn_Add.Enabled = true;
                btn_Edit.Enabled = true;
                btn_Delete.Enabled = true; 
            }
            #endregion
            #region IfSales
            if (permissions == 2)
            {
                if (department == "TBL_INVOICES")
                {
                    btn_Add.Enabled = false;
                    btn_Edit.Enabled = false;
                    btn_Delete.Enabled = false;
                }
                else
                {
                    btn_Add.Enabled = true;
                    btn_Edit.Enabled = true;
                    btn_Delete.Enabled = true;
                }
            }
            #endregion
            #region IfFinance
            if (permissions == 3)
            {
                if (department == "TBL_PROJECTS" || department == "TBL_APPOINTMENTS")
                {
                    btn_Add.Enabled = false;
                    btn_Edit.Enabled = false;
                    btn_Delete.Enabled = false;
                }
                else
                {
                    btn_Add.Enabled = true;
                    btn_Edit.Enabled = true;
                    btn_Delete.Enabled = true;
                }
            }
            #endregion
            #region IfDevelopment
            if (permissions == 4)
            {
                if (department == "TBL_CUSTOMERS" || department == "TBL_INVOICES" || department == "TBL_APPOINTMENTS")
                {
                    btn_Add.Enabled = false;
                    btn_Edit.Enabled = false;
                    btn_Delete.Enabled = false;
                }
                else
                {
                    btn_Add.Enabled = false;
                    btn_Edit.Enabled = true;
                    btn_Delete.Enabled = false;
                }
            }
            #endregion
        }
 public frm_Login(int permissions)
 {
     InitializeComponent();
     dbh = new SQLDatabaseHandler();
     this.permissions = permissions;
 }