예제 #1
0
        public void savaMissMember()
        {
            string idNhiemvu;

            if (!checkNullMember())
            {
                if (checkMission(frmmissionteam.cbb_NVMem.Text))
                {
                    idNhiemvu = frmmissionteam.cbb_NVMem.SelectedValue.ToString();
                }
                else
                {
                    idNhiemvu = addNewMission(frmmissionteam.cbb_NVMem.Text, frmmissionteam.tb_NVMem.Text);
                }

                int idDiaChi = addNewAddress(frmmissionteam.cbb_XaMem.SelectedValue.ToString(), frmmissionteam.cbb_HuyenMem.SelectedValue.ToString(), frmmissionteam.cbb_TinhMem.SelectedValue.ToString()
                                             , frmmissionteam.tb_DCCuTheMem.Text);
                string   idThanhVien  = frmmissionteam.cbb_ThanhVien.SelectedValue.ToString();
                DateTime dateTime     = frmmissionteam.dtp_HanHTMem.Value;
                string   hanHoanThanh = String.Format("{0:u}", dateTime);
                hanHoanThanh = hanHoanThanh.Substring(0, hanHoanThanh.Length - 1);
                if (saveMission(1, idThanhVien, idNhiemvu, idDiaChi.ToString(), hanHoanThanh))
                {
                    uc_missionMem[demPCMem]                     = new GUI.uc_Mission();
                    uc_missionMem[demPCMem].BorderStyle         = System.Windows.Forms.BorderStyle.FixedSingle;
                    uc_missionMem[demPCMem].Dock                = System.Windows.Forms.DockStyle.Top;
                    uc_missionMem[demPCMem].Location            = new System.Drawing.Point(0, 0);
                    uc_missionMem[demPCMem].Tag                 = demPCTeam;
                    uc_missionMem[demPCMem].Size                = new System.Drawing.Size(frmmissionteam.pn_NVMember.Size.Width, 90);
                    uc_missionMem[demPCMem].lb_MissionName.Text = frmmissionteam.cbb_NVMem.Text;
                    uc_missionMem[demPCMem].lb_Deadline.Text    = "Deadline: " + frmmissionteam.dtp_HanHTMem.Value;

                    closeMission            = new Label();
                    closeMission.Cursor     = System.Windows.Forms.Cursors.Hand;
                    closeMission.Font       = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    closeMission.Image      = global::CDIO_QLCLB.Properties.Resources.close;
                    closeMission.Location   = new System.Drawing.Point(uc_missionMem[demPCMem].Size.Width - 30, 7);
                    closeMission.Name       = "lb_Close";
                    closeMission.Size       = new System.Drawing.Size(20, 20);
                    closeMission.Tag        = demPCTeam + "-" + idNhiemvu + "-" + idDiaChi;
                    closeMission.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
                    closeMission.Click     += new EventHandler(lb_CloseClickMem);

                    uc_missionMem[demPCMem].Controls.Add(closeMission);
                    frmmissionteam.pn_NVMember.Controls.Add(uc_missionMem[demPCMem]);
                    demPCMem++;
                }
            }
        }
예제 #2
0
        public void saveMissionTeam()
        {
            string idMission;

            if (checkMission(frmmissionteam.cbb_NVTeam.Text))
            {
                idMission = frmmissionteam.cbb_NVTeam.SelectedValue.ToString();
            }
            else
            {
                idMission = addNewMission(frmmissionteam.cbb_NVTeam.Text, frmmissionteam.tb_NVTeam.Text);
            }

            if (checknullAddressTeam())
            {
                string idDiaChi = addNewAddress(frmmissionteam.cbb_TenXa.SelectedValue.ToString(), frmmissionteam.cbb_TenHuyen.SelectedValue.ToString(),
                                                frmmissionteam.cbb_TenTinh.SelectedValue.ToString(), frmmissionteam.tb_DiaChiCuThe.Text).ToString();
                DateTime daymiss  = frmmissionteam.dtp_NgayHoanThanhTeam.Value;
                string   deadline = string.Format("{0:u}", daymiss);
                if (saveMission(0, teamID, idMission, idDiaChi, deadline.Substring(0, deadline.Length - 1)))
                {
                    uc_missionTeam[demPCTeam]                     = new GUI.uc_Mission();
                    uc_missionTeam[demPCTeam].BorderStyle         = System.Windows.Forms.BorderStyle.FixedSingle;
                    uc_missionTeam[demPCTeam].Dock                = System.Windows.Forms.DockStyle.Top;
                    uc_missionTeam[demPCTeam].Location            = new System.Drawing.Point(0, 0);
                    uc_missionTeam[demPCTeam].Tag                 = demPCTeam;
                    uc_missionTeam[demPCTeam].Size                = new System.Drawing.Size(frmmissionteam.pn_NhiemVu.Size.Width, 90);
                    uc_missionTeam[demPCTeam].lb_MissionName.Text = frmmissionteam.cbb_NVTeam.Text;
                    uc_missionTeam[demPCTeam].lb_Deadline.Text    = "Deadline: " + frmmissionteam.dtp_NgayHoanThanhTeam.Value;

                    closeMission            = new Label();
                    closeMission.Cursor     = System.Windows.Forms.Cursors.Hand;
                    closeMission.Font       = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    closeMission.Image      = global::CDIO_QLCLB.Properties.Resources.close;
                    closeMission.Location   = new System.Drawing.Point(uc_missionTeam[demPCTeam].Size.Width - 30, 7);
                    closeMission.Name       = "lb_Close";
                    closeMission.Size       = new System.Drawing.Size(20, 20);
                    closeMission.Tag        = demPCTeam + "-" + idMission + "-" + idDiaChi;
                    closeMission.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
                    closeMission.Click     += new EventHandler(lb_CloseClick);

                    uc_missionTeam[demPCTeam].Controls.Add(closeMission);
                    frmmissionteam.pn_NhiemVu.Controls.Add(uc_missionTeam[demPCTeam]);
                    demPCTeam++;
                }
            }
        }