Esempio n. 1
0
        public EvaluationDetailForm(string id)
        {
            InitializeComponent();
            this.id = id;
            string url   = ApiRouting.GetUrl("", "", "evaluation", ApiFunction.GetById).ToString() + "?EvId=" + id;
            bool   getEv = url.Get <VEvaluation>(ref listEv);

            if (!getEv)
            {
                MessageBox.Show("Cannot Connect To Server!");
                return;
            }
            VEvaluation vEvaluation = listEv[0];

            lbCreatedDate.Text = vEvaluation.CreatedDate;
            lbDescription.Text = vEvaluation.EvDescription;
            lbFromDate.Text    = vEvaluation.fromDate;
            lbToDate.Text      = vEvaluation.toDate;
            lbStatus.Text      = vEvaluation.Status;
            string evQUrl = ApiRouting.GetUrl("", "", "evaluationDetail", ApiFunction.GetByEvId).ToString() + "?EvId=" + id;
            bool   getEvQ = evQUrl.GetDeserializeObject <VEvaluationDetail>(ref EVD);

            if (!getEvQ)
            {
                MessageBox.Show("Cannot Connect To Server!");
                return;
            }
            dataGridQuestion.DataSource = EVD.VEvaluationQuestion.Select(x => new { ID = x.EvQId, Description = x.EvQDescription }).ToList();
            dataGridStaff.DataSource    = EVD.vEvaluationDetailStaff;
            //dataGridQuestion.DataSource = listEVQ.Select(x=> new {ID = x.EvQId,Description = x.EvQDescription }).ToList();
        }
Esempio n. 2
0
        public SelectQuestion()
        {
            InitializeComponent();
            listEvQ = new List <Entity.VEvaluationQuestion>();
            string url     = ApiRouting.GetUrl("", "", "evaluationQuestion", ApiFunction.GetAll).ToString();
            bool   confirm = url.Get <Entity.VEvaluationQuestion>(ref listEvQ);

            if (!confirm)
            {
                MessageBox.Show("Operation Failed");
            }
            dataGridMain.DataSource = listEvQ.Select(x => new { Description = x.EvQDescription }).ToList();
            dataGridMain.Columns[0].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridMain.Columns.Add(new DataGridViewCheckBoxColumn()
            {
                HeaderText = "Selected", Name = "Selected", TrueValue = true, FalseValue = false
            });
            dataGridMain.Columns[dataGridMain.Columns.Count - 1].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            foreach (DataGridViewColumn col in dataGridMain.Columns)
            {
                if (col.HeaderText != "Selected")
                {
                    col.ReadOnly = true;
                }
            }
        }
Esempio n. 3
0
        public SelectStaff()
        {
            InitializeComponent();
            obj            = Singleton.Instance.Container.Resolve <AddEvaluation>();
            listDepartment = new List <VDepartment>();
            listOffice     = new List <VOffice>();
            listStaff      = new List <VStaff>();
            bool conDepartment = ApiRouting.GetUrl("", "", "department", ApiFunction.GetAll).ToString().Get <VDepartment>(ref listDepartment);
            bool conOffice     = ApiRouting.GetUrl("", "", "office", ApiFunction.GetAll).ToString().Get <VOffice>(ref listOffice);
            bool conStaff      = ApiRouting.GetUrl("", "", "staff", ApiFunction.GetAll).ToString().Get <VStaff>(ref listStaff);

            dataGridMain.DataSource    = listStaff.Select(x => new { ID = x.StaffId, Name = x.Sname, Office = x.OfficeId, Department = x.DeptId }).ToList();
            comboDepartment.DataSource = listDepartment.Select(x => x.Deptname).ToList();
            comboOffice.DataSource     = listOffice.Select(x => x.OfficeName).ToList();
            dataGridMain.Columns[0].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridMain.AutoGenerateColumns = false;
            dataGridMain.Columns.Add(new DataGridViewCheckBoxColumn()
            {
                HeaderText = "Selected", Name = "Selected", TrueValue = true, FalseValue = false
            });
            dataGridMain.Columns[dataGridMain.Columns.Count - 1].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            foreach (DataGridViewColumn col in dataGridMain.Columns)
            {
                if (col.HeaderText != "Selected")
                {
                    col.ReadOnly = true;
                }
            }
        }
Esempio n. 4
0
        private void BtnDeleteEvaluation_Click(object sender, EventArgs e)
        {
            int         index       = dataGridMain.CurrentCell.RowIndex;
            string      EvId        = dataGridMain.Rows[index].Cells[0].Value.ToString();
            VEvaluation vEvaluation = new VEvaluation()
            {
                CreatedDate   = "",
                EvId          = EvId,
                EvDescription = "",
                fromDate      = "",
                StaffId       = "",
                Status        = "",
                toDate        = "",
                EvTId         = ""
            };
            string queryString = vEvaluation.GetQueryString();
            string url         = ApiRouting.GetUrl("", "", "evaluation", ApiFunction.DeleteById).ToString() + queryString;
            bool   confirm     = url.Detete <VEvaluation>();

            if (confirm)
            {
                MessageBox.Show("Operation Succesful", "Successful");
                Init();
            }
        }
Esempio n. 5
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            int    index = dataGridMain.CurrentCell.RowIndex;
            string id    = dataGridMain.Rows[index].Cells[0].Value.ToString();
            User   user  = new User()
            {
                Created_date = "",
                Password     = "",
                Regcom_id    = "",
                StaffId      = "",
                Status       = "",
                Username     = "",
                UserId       = id,
                Role         = ""
            };
            string queryString = user.GetQueryString <User>();
            string url         = ApiRouting.GetUrl("", "", "user", ApiFunction.DeleteById).ToString() + queryString;
            bool   confirm     = url.Detete <User>();

            if (!confirm)
            {
                MessageBox.Show("Cannot delete user account!");
            }
            Init();
        }
Esempio n. 6
0
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            if (txtType.TextLength == 0)
            {
                MessageBox.Show("Please input information");
                return;
            }
            string         text           = txtType.Text.Trim();
            EvaluationType evaluationType = new EvaluationType()
            {
                EvTName = text, EvTId = ""
            };
            string json    = JsonConvert.SerializeObject(evaluationType);
            string url     = ApiRouting.GetUrl("", "", "evaluationType", ApiFunction.Add).ToString();
            bool   confirm = url.Post <EvaluationType>(json);

            if (confirm)
            {
                MessageBox.Show("Operation Successful");
            }
            else
            {
                MessageBox.Show("Operation Falied");
            }
            txtType.Clear();
            var evtObj = Singleton.Instance.Container.Resolve <MainView>("evaluation type");

            evtObj.Init();
        }
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            int    index   = dataGridMain.CurrentCell.RowIndex;
            string StaffId = dataGridMain.Rows[index].Cells[0].Value.ToString();
            Staff  staff   = new Staff()
            {
                CreatedBy      = "",
                CurrentAddress = "",
                DeptID         = "",
                Dob            = "",
                Email          = "",
                OfficeId       = "",
                Phone          = "",
                Pid            = "",
                Pob            = "",
                SName          = "",
                Sex            = "",
                UserGroupID    = "",
                StaffId        = StaffId
            };
            string queryString = staff.GetQueryString <Staff>();
            string url         = ApiRouting.GetUrl("", "", "staff", ApiFunction.DeleteById).ToString() + queryString;
            bool   confirm     = url.Detete <Staff>();

            if (confirm)
            {
                MessageBox.Show("Deleted Successful", "Deleted Successful");
                Init();
            }
        }
Esempio n. 8
0
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            string officeName = txtOfficeName.Text.Trim();

            if (officeName.Length == 0)
            {
                MessageBox.Show("Office Name Required !", "Invalid Input");
                return;
            }
            string deptName = comboDepartment.SelectedItem.ToString();
            string deptId   = listDepartment.Where(x => x.Deptname == deptName).Select(x => x.DeptId).FirstOrDefault();
            Office office   = new Office()
            {
                DeptId = deptId, OfficeName = officeName
            };
            string url       = ApiRouting.GetUrl("", "", "office", ApiFunction.Add).ToString();
            string json      = JsonConvert.SerializeObject(office);
            bool   confirm   = url.Post <Office>(json);
            var    objOffice = Singleton.Instance.Container.Resolve <MainView>("office");

            if (confirm)
            {
                MessageBox.Show("Office added successful", "Successful");
                objOffice.Init();
            }
            else
            {
                MessageBox.Show("Connection Error!", "Error!");
            }
        }
Esempio n. 9
0
        public AddOfficeForm()
        {
            InitializeComponent();
            listDepartment = new List <VDepartment>();
            bool confirm = ApiRouting.GetUrl("", "", "department", ApiFunction.GetAll).ToString().Get <VDepartment>(ref listDepartment);

            comboDepartment.DataSource = listDepartment.Select(x => x.Deptname).ToList();
        }
Esempio n. 10
0
        public override void Init()
        {
            List <VDepartment> list = new List <VDepartment>();
            string             url  = ApiRouting.GetUrl("", "", "department", ApiFunction.GetAll).ToString();
            bool status             = url.Get <VDepartment>(ref list);

            dataGridMain.DataSource = list;
            MessageBox.Confirm(status, "department", dataGridMain);
        }
Esempio n. 11
0
        public override void Init()
        {
            string url     = ApiRouting.GetUrl("", "", "user", ApiFunction.GetAll).ToString();
            bool   confirm = url.Get <VUser>(ref listUser);

            if (confirm)
            {
                dataGridMain.DataSource = listUser;
            }
        }
Esempio n. 12
0
        public override void Init()
        {
            string url     = ApiRouting.GetUrl("", "", "evaluationQuestion", ApiFunction.GetAll).ToString();
            bool   confirm = url.Get <Entity.VEvaluationQuestion>(ref listEvQ);

            if (confirm)
            {
                dataGridMain.DataSource = listEvQ;
            }
        }
Esempio n. 13
0
        public override void Init()
        {
            listRole = new List <VUsergroup>();
            bool conRole = ApiRouting.GetUrl("", "", "usergroup", ApiFunction.GetAll).ToString().Get <VUsergroup>(ref listRole);

            if (conRole)
            {
                DataGridMain.DataSource = listRole;
            }
        }
        public override void Init()
        {
            List <VStaff> listStaff = new List <VStaff>();
            bool          confirm   = ApiRouting.GetUrl("", "", "staff", ApiFunction.GetAll).ToString().Get <VStaff>(ref listStaff);

            if (confirm)
            {
                dataGridMain.DataSource = listStaff;
                MessageBox.Confirm(confirm, "staff", dataGridMain);
            }
        }
        public StaffView()
        {
            InitializeComponent();
            List <VStaff> listStaff = new List <VStaff>();
            bool          confirm   = ApiRouting.GetUrl("", "", "staff", ApiFunction.GetAll).ToString().Get <VStaff>(ref listStaff);

            if (confirm)
            {
                dataGridMain.DataSource = listStaff;
            }
        }
Esempio n. 16
0
        public EvaluatedHistroy()
        {
            InitializeComponent();
            string url     = ApiRouting.GetUrl("", "", "assignstaff", ApiFunction.GetEvByStaffId).ToString() + "?StaffId=" + GlobalVariable.StaffID;
            bool   confirm = url.Get <VEvaluationHistoryOnStaff>(ref listEvH);

            if (confirm)
            {
                dataGridMain.DataSource = listEvH.Select(x => new { ID = x.EvId, Description = x.EvDescription, Duration = x.duration, Status = x.Status }).ToList();
            }
        }
Esempio n. 17
0
        public void Init()
        {
            string url     = ApiRouting.GetUrl("", "", "dailyactivitydetail", ApiFunction.GetByStaDAId).ToString() + "?StaDAId=" + StaDAId;
            bool   confirm = url.Get <VDailyActivitiesNoQuestion>(ref listVAddActivity);

            if (!confirm)
            {
                MessageBox.Show("Cannot connect to server!!");
                return;
            }
            dataGridMain.DataSource = listVAddActivity;
        }
Esempio n. 18
0
        public AddEvaluation()
        {
            InitializeComponent();
            listEvaType = new List <VEvaluationType>();
            string url     = ApiRouting.GetUrl("", "", "evaluationType", ApiFunction.GetAll).ToString();
            bool   confirm = url.Get <VEvaluationType>(ref listEvaType);

            if (confirm)
            {
                comboType.DataSource = listEvaType.Select(x => x.EvTName).ToList();
            }
        }
Esempio n. 19
0
        public void Init()
        {
            string url     = ApiRouting.GetUrl("", "", "dailyactivity", ApiFunction.GetAll).ToString() + "?StaffId=" + GlobalVariable.StaffID;
            bool   confirm = url.Get <VDailyActivities>(ref listDAct);

            if (!confirm)
            {
                MessageBox.Show("Cannot connect to server!");
                return;
            }
            dataGridActivities.DataSource = listDAct;
            ConfigureGridAct();
        }
Esempio n. 20
0
        public UserAccount()
        {
            InitializeComponent();
            listDepartment = new List <VDepartment>();
            listOffice     = new List <VOffice>();
            bool conDepartment = ApiRouting.GetUrl("", "", "department", ApiFunction.GetAll).ToString().Get <VDepartment>(ref listDepartment);
            bool conOffice     = ApiRouting.GetUrl("", "", "office", ApiFunction.GetAll).ToString().Get <VOffice>(ref listOffice);

            comboOffice.DataSource        = listOffice.Select(x => x.OfficeName).ToList();
            comboDepartment.DataSource    = listDepartment.Select(x => x.Deptname).ToList();
            comboOffice.SelectedIndex     = -1;
            comboDepartment.SelectedIndex = -1;
            listUser = new List <VUser>();
        }
        public override void Init()
        {
            string url     = ApiRouting.GetUrl("", "", "usergroup", ApiFunction.GetAll).ToString();
            bool   confirm = url.Get <VGroup>(ref listGroup);

            if (confirm)
            {
                dataGridMain.DataSource = listGroup;
            }
            else
            {
                MessageBox.Show("Cannot connect to server!", "Error");
            }
        }
        public override void Init()
        {
            string url     = ApiRouting.GetUrl("", "", "position", ApiFunction.GetAll).ToString();
            bool   confirm = url.Get <VPosition>(ref listPosition);

            if (confirm)
            {
                dataGridMain.DataSource = listPosition;
            }
            else
            {
                MessageBox.Show("Cannot Connect To Server!", "Connection Error");
            }
        }
Esempio n. 23
0
        public override void Init()
        {
            string url     = ApiRouting.GetUrl("", "", "dailyactivity", ApiFunction.GetAllByManager).ToString() + "?StaffId=" + GlobalVariable.StaffID;
            bool   confirm = url.Get <VAllDailyActivity>(ref listAllDActivity);

            dataGridMain.DataSource = listAllDActivity;
            foreach (DataGridViewRow dt in dataGridMain.Rows)
            {
                if ((string)dt.Cells["Status"].Value == "Pending")
                {
                    dt.DefaultCellStyle.ForeColor = Color.Red;
                }
            }
        }
Esempio n. 24
0
        public override void Init()
        {
            string url     = ApiRouting.GetUrl("", "", "evaluationType", ApiFunction.GetAll).ToString();
            bool   confirm = url.Get <VEvaluationType>(ref listEvT);

            if (confirm)
            {
                dataGridMain.DataSource = listEvT;
            }
            else
            {
                MessageBox.Show("Operation Failed");
            }
        }
Esempio n. 25
0
        public EvaluationQuestionDetail(string EvQId, string Question)
        {
            InitializeComponent();
            listEvQD = new List <VEvaluationQuestionDetail>();
            string url     = ApiRouting.GetUrl("", "", "evaluationQuestionDetail", ApiFunction.GetById).ToString() + "?EvQId=" + EvQId;
            bool   confirm = url.Get <Entity.VEvaluationQuestionDetail>(ref listEvQD);

            if (confirm)
            {
                txtAnswer.Text   = listEvQD[0].Answer;
                txtMaxScore.Text = listEvQD[0].MaxScore + "";
                txtMinScore.Text = listEvQD[0].MinScore + "";
                txtQuestion.Text = Question;
            }
        }
Esempio n. 26
0
 public AddStaffForm()
 {
     InitializeComponent();
     listDepartment = new List <VDepartment>();
     listOffice     = new List <VOffice>();
     listPosition   = new List <VPosition>();
     listUserGroup  = new List <VUsergroup>();
     ApiRouting.GetUrl("", "", "department", ApiFunction.GetAll).ToString().Get <VDepartment>(ref listDepartment);
     ApiRouting.GetUrl("", "", "office", ApiFunction.GetAll).ToString().Get <VOffice>(ref listOffice);
     ApiRouting.GetUrl("", "", "position", ApiFunction.GetAll).ToString().Get <VPosition>(ref listPosition);
     ApiRouting.GetUrl("", "", "usergroup", ApiFunction.GetAll).ToString().Get <VUsergroup>(ref listUserGroup);
     comboDepartment.DataSource = listDepartment.Select(x => x.Deptname).ToList();
     comboOffice.DataSource     = listOffice.Select(x => x.OfficeName).ToList();
     comboGroup.DataSource      = listUserGroup.Select(x => x.Name).ToList();
     comboPosition.DataSource   = listPosition.Select(x => x.Pname).ToList();
 }
Esempio n. 27
0
        private void BtnDeleteDepartment_Click(object sender, EventArgs e)
        {
            int        index      = dataGridMain.CurrentCell.RowIndex;
            string     id         = dataGridMain.Rows[index].Cells[0].Value.ToString();
            Department department = new Department()
            {
                Deptname = "", DeptId = id
            };
            string QueryString = department.GetQueryString <Department>();
            string url         = ApiRouting.GetUrl("", "", "department", ApiFunction.DeleteById).ToString() + QueryString;
            bool   confirm     = url.Detete <Department>();

            if (confirm)
            {
                this.Init();
            }
        }
Esempio n. 28
0
        private bool AddStaff()
        {
            string name       = txtName.Text.Trim();
            string sex        = comboGender.SelectedItem.ToString();
            string dob        = dtDOB.Value.ToShortDateString();
            string address    = txtAddress.Text.Trim();
            string phone      = txtPhone.Text.Trim();
            string email      = txtEmail.Text.Trim();
            string deptName   = comboDepartment.SelectedItem.ToString();
            string deptId     = listDepartment.Where(x => x.Deptname == deptName).Select(x => x.DeptId).FirstOrDefault();
            string officeName = comboOffice.SelectedItem.ToString();
            string officeId   = listOffice.Where(x => x.OfficeName == officeName).Select(x => x.OfficeId).FirstOrDefault();
            string position   = comboPosition.SelectedItem.ToString();
            string positionId = listPosition.Where(x => x.Pname == position).Select(x => x.Pid).FirstOrDefault();
            string group      = comboGroup.SelectedItem.ToString();
            string groupId    = listUserGroup.Where(x => x.Name == group).Select(x => x.UserGroupID).FirstOrDefault();
            Staff  staff      = new Staff()
            {
                CreatedBy      = GlobalVariable.LoginStaffName,
                CurrentAddress = address,
                DeptID         = deptId,
                Dob            = dob,
                Email          = email,
                OfficeId       = officeId,
                Phone          = phone,
                Pid            = positionId,
                Pob            = address,
                SName          = name,
                Sex            = sex,
                UserGroupID    = groupId,
                StaffId        = ""
            };
            string json    = JsonConvert.SerializeObject(staff);
            string url     = ApiRouting.GetUrl("", "", "staff", ApiFunction.Add).ToString();
            bool   confirm = url.Post <Staff>(json);

            if (confirm)
            {
                MessageBox.Show("Staff Added Successful", "Successful");
                var objStaff = Singleton.Instance.Container.Resolve <MainView>("staff");
                objStaff.Init();
                return(true);
            }
            return(false);
        }
Esempio n. 29
0
        public AddUserAccount()
        {
            InitializeComponent();
            listDepartment = new List <VDepartment>();
            bool conDepartment = ApiRouting.GetUrl("", "", "department", ApiFunction.GetAll).ToString().Get <VDepartment>(ref listDepartment);
            bool conOffice     = ApiRouting.GetUrl("", "", "office", ApiFunction.GetAll).ToString().Get <VOffice>(ref listOffice);
            bool conStaff      = ApiRouting.GetUrl("", "", "staff", ApiFunction.GetAll).ToString().Get <VStaff>(ref listStaff);
            bool conRole       = ApiRouting.GetUrl("", "", "usergroup", ApiFunction.GetAll).ToString().Get <UserRole>(ref listRole);

            comboRole.DataSource       = listRole.Select(x => x.Name).ToList();
            comboStaff.DataSource      = listStaff.Select(x => x.Sname).ToList();
            comboDepartment.DataSource = listDepartment.Select(x => x.Deptname).ToList();
            comboOffice.DataSource     = listOffice.Select(x => x.OfficeName).ToList();
            if (!conDepartment || !conOffice || !conStaff)
            {
                MessageBox.Show("Cannot connect to server!", "Error");
            }
        }
Esempio n. 30
0
        public override void Init()
        {
            string url     = ApiRouting.GetUrl("", "", "evaluation", ApiFunction.GetAll).ToString();
            bool   confirm = url.Get <VEvaluation>(ref listEva);

            if (confirm)
            {
                dataGridMain.DataSource = listEva.Select(x => new
                {
                    ID           = x.EvId,
                    Description  = x.EvDescription,
                    Start_Date   = x.fromDate,
                    End_Date     = x.toDate,
                    Created_Date = x.CreatedDate,
                    Created_By   = x.StaffId,
                    x.Status
                }).ToList();
            }
        }