public CreateAc(EditMenu m)
        {
            InitializeComponent();
            this.m = m;
            Dictionary <String, String> comboSource = new Dictionary <String, String>();

            comboSource.Add("1", "RM");
            comboSource.Add("2", "PM");
            comboSource.Add("3", "CM");
            comboSource.Add("4", "WC");
            comboSource.Add("5", "AD");
            comboSource.Add("6", "AM");
            comboBox1.DataSource    = new BindingSource(comboSource, null);
            comboBox1.DisplayMember = "Value";
            comboBox1.ValueMember   = "Key";
            Dictionary <String, String> comboSource2 = new Dictionary <String, String>();
            MySqlDataAdapter            sda          = new MySqlDataAdapter("select RestNo, RestName from Restaurant;", cnn);
            DataTable dt = new DataTable();

            sda.Fill(dt);
            int i = 1;

            foreach (DataRow dr in dt.Rows)
            {
                String restInfo = dr["RestNo"].ToString() + " - " + dr["RestName"].ToString();
                comboSource2.Add(i++.ToString(), restInfo);
            }
            comboBox2.DataSource    = new BindingSource(comboSource2, null);
            comboBox2.DisplayMember = "Value";
            comboBox2.ValueMember   = "Key";
        }
        public CreateRest(EditMenu m)
        {
            InitializeComponent();
            this.m = m;
            int              restID;
            MySqlConnection  cnn = new MySqlConnection("server=code4cat.me;user id=jackysc;password=123456;database=procurement;SslMode=none;");
            MySqlDataAdapter sda = new MySqlDataAdapter("select Max(RestNo) from Restaurant;", cnn);
            DataTable        dt  = new DataTable();

            sda.Fill(dt);
            rid = dt.Rows[0][0].ToString();
            //add 1 to the restaurant number
            rid       = Regex.Match(rid, @"\d+").Value;
            restID    = Int32.Parse(rid);
            restID   += 1;
            rid       = "R" + restID.ToString().PadLeft(3, '0');
            tbID.Text = rid;
            Dictionary <String, String> comboSource = new Dictionary <String, String>();
            MySqlDataAdapter            sda2        = new MySqlDataAdapter("select distinct name from Category where parent_id is not null;", cnn);
            DataTable dt2 = new DataTable();

            sda2.Fill(dt2);
            int i = 1;

            foreach (DataRow dr2 in dt2.Rows)
            {
                comboSource.Add(i++.ToString(), dr2["name"].ToString());
            }
            comboBox1.DataSource    = new BindingSource(comboSource, null);
            comboBox1.DisplayMember = "Value";
            comboBox1.ValueMember   = "Key";
        }
 public EditAc(String deptCode, String userDept, String StaffNo, EditMenu em)
 {
     InitializeComponent();
     this.StaffNo  = StaffNo;
     this.deptCode = deptCode;
     this.em       = em;
     this.userDept = userDept;
     if (userDept == "AM" && deptCode == "RM")
     {
         comboBox2.Enabled = true;
         comboBox2.Visible = true;
     }
     else
     {
         comboBox2.Visible = false;
         label7.Visible    = false;
     }
     setData();
 }
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            switch (deptCode)
            {
            case "AM":
                this.Hide();
                EditMenu em = new EditMenu(this, 0);
                em.Show();
                break;

            case "RM":
                this.Hide();
                PurchaseRequest pr = new PurchaseRequest(this, restNo, StaffNo);
                pr.Show();
                break;

            case "PM":
                this.Hide();
                TypeofAgreementMenu tam = new TypeofAgreementMenu(staffName, this);
                tam.Show();
                break;

            case "CM":
                this.Hide();
                Category cat = new Category(this);
                cat.Show();
                break;

            case "WC":
                this.Hide();
                WHViewDPI dpi = new WHViewDPI(this);
                dpi.Show();
                break;

            case "AD":
                this.Hide();
                TypeofAgreementMenu adtam = new TypeofAgreementMenu(staffName, this);
                adtam.Show();
                break;
            }
        }
        public EditRest(String restNo, EditMenu em)
        {
            InitializeComponent();
            this.restNo = restNo;
            Dictionary <String, String> comboSource = new Dictionary <String, String>();
            MySqlDataAdapter            sda         = new MySqlDataAdapter("select distinct name from Category where parent_id is not null;", cnn);
            DataTable dt = new DataTable();

            sda.Fill(dt);
            int i = 1;

            foreach (DataRow dr in dt.Rows)
            {
                comboSource.Add(i++.ToString(), dr["name"].ToString());
            }
            comboBox1.DataSource    = new BindingSource(comboSource, null);
            comboBox1.DisplayMember = "Value";
            comboBox1.ValueMember   = "Key";
            setData();
            this.em = em;
        }
Beispiel #6
0
        private void btn2_Click(object sender, EventArgs e)
        {
            switch (deptCode)
            {
            case "PM":
                this.Hide();
                PRMapping prm = new PRMapping(this);
                prm.Show();
                break;

            case "RM":
                this.Hide();
                ViewDeliveryNoteMenu vDN = new ViewDeliveryNoteMenu(this, "RM", restNo);
                vDN.Show();
                break;

            case "AD":
            case "WC":
                this.Hide();
                ViewDeliveryNoteMenu WHvDN = new ViewDeliveryNoteMenu(this, "WC");
                WHvDN.Show();
                break;

            case "AM":
                this.Hide();
                EditMenu em = new EditMenu(this, 1);
                em.Show();
                break;

            case "CM":
                this.Hide();
                Item itm = new Item(this);
                itm.Show();
                break;
            }
        }