示例#1
0
        private void workers_modify_button_Click(object sender, EventArgs e)
        {
            if (workers_dataGridView.SelectedRows.Count == 0)
            {
                Common.ErrAlert("请选择一行再修改!");
                return;
            }
            WorkerListData worker = workerListData.ToList()[workers_dataGridView.SelectedRows[0].Index];

            if (null == worker)
            {
                Common.ErrAlert("加载选择的工人数据发生错误!");
                return;
            }
            if (null == WorkerProjectInfo)
            {
                Common.ErrAlert("请选择项目后再操作!");
                return;
            }
            WorkerInfoForm workerInfoForm = new WorkerInfoForm(db, worker, WorkerProjectInfo, loginUser, workerTypes, nations);

            if (workerInfoForm.ShowDialog() == DialogResult.OK)
            {
                LoadWorkersData(workers_projects_comboBox);
            }
        }
示例#2
0
        /// <summary>
        /// 提交删除工人请求
        /// </summary>
        /// <param name="workerDeleteRequestData"></param>
        /// <param name="loginUser"></param>
        /// <param name="commonResponse"></param>
        public static void RequestDelAction(WorkerListData worker, LoginUser loginUser, ref CommonResponseData commonResponse)
        {
            object data = new
            {
                worker.projectCode,
                worker.teamSysNo,
                idCardType = 1,
                worker.idCardNumber
            };

            Common.PostRequest(data, ConfigurationManager.AppSettings["baseURL"].ToString(), Properties.Resources.DeleteWorker, loginUser.LoginToken, "application/json", ref commonResponse);
        }
示例#3
0
 public WorkerInfoForm(SQLiteConnection db,
                       WorkerListData worker,
                       ProjectInfo workerProjectInfo,
                       LoginUser loginUser,
                       List <WorkerType> workerTypes,
                       List <Nation> nations)
 {
     InitializeComponent();
     this.db                = db;
     this.worker            = worker;
     this.workerProjectInfo = workerProjectInfo;
     this.loginUser         = loginUser;
     this.workerTypes       = workerTypes;
     this.nations           = nations;
 }
示例#4
0
        private void worker_del_button_Click(object sender, EventArgs e)
        {
            if (workers_dataGridView.SelectedRows.Count == 0)
            {
                Common.ErrAlert("请选择一行再删除!");
                return;
            }
            WorkerListData worker = workerListData.ToList()[workers_dataGridView.SelectedRows[0].Index];

            if (null == worker)
            {
                Common.ErrAlert("加载选择的工人数据发生错误!");
                return;
            }
            if (null == WorkerProjectInfo)
            {
                Common.ErrAlert("请选择项目后再操作!");
                return;
            }
            if (MessageBox.Show(string.Format("真的要删除工人 {0} 吗?", worker.workerName), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }
            CommonResponseData commonResponseData = new CommonResponseData();

            WorkerRequestService.RequestDelAction(worker, loginUser, ref commonResponseData);
            if (null == commonResponseData)
            {
                Common.ErrAlert("网络或服务异常,请联系管理员!");
                return;
            }
            if (!commonResponseData.success)
            {
                Common.ErrAlert("删除失败!\n" + commonResponseData.message);
                return;
            }
            Common.SuccessAlert("删除成功!");
            LoadWorkersData(workers_projects_comboBox);
        }