Exemple #1
0
 /// <summary>
 /// 跳转到分配部门界面
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAssignUser_Click(object sender, EventArgs e)
 {
     if (D_ID != null)
     {
         DepartmentDto dep = AutofacConfig.DepartmentService.GetDepartmentByDepID(D_ID);
         if (dep != null)
         {
             DepInputDto department = new DepInputDto();
             department.DEPARTMENTID = dep.DEPARTMENTID;
             department.NAME         = dep.NAME;
             department.MANAGER      = dep.MANAGER;
             department.IMAGEID      = dep.IMAGEID;
             frmDepAssignUser frmDepAssignUser = new frmDepAssignUser();
             frmDepAssignUser.department = department;
             Show(frmDepAssignUser, (MobileForm form, object args) =>
             {
                 if (frmDepAssignUser.ShowResult == ShowResult.Yes)
                 {
                     ShowResult = ShowResult.Yes;
                     Close();
                 }
             });
         }
     }
 }
Exemple #2
0
        AutofacConfig AutofacConfig = new AutofacConfig(); //调用配置类
        #endregion

        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtDep_Name.Text.Trim().Length <= 0)
                {
                    throw new Exception("请输入部门名称!");
                }

                if (leader.Length <= 0)
                {
                    throw new Exception("请输入责任人!");
                }
                DepInputDto department = new DepInputDto();
                department.NAME       = txtDep_Name.Text;
                department.MODIFYUSER = Client.Session["UserID"].ToString();
                department.MANAGER    = leader;
                if (string.IsNullOrEmpty(D_Portrait) == false)
                {
                    department.IMAGEID = D_Portrait;
                }
                else
                {
                    department.IMAGEID = "";
                }
                if (string.IsNullOrEmpty(D_ID) == false)
                {
                    department.DEPARTMENTID = D_ID;
                    List <coreUser> listuserDto = AutofacConfig.coreUserService.GetUserByDepID(D_ID);
                    List <string>   listUser    = new List <string> ();
                    foreach (coreUser user in listuserDto)
                    {
                        listUser.Add(user.USER_ID);
                    }
                    department.UserIDs = listUser;
                    ReturnInfo result = AutofacConfig.DepartmentService.UpdateDepartment(department);
                    if (result.IsSuccess == false)
                    {
                        throw new Exception(result.ErrorInfo);
                    }
                    else
                    {
                        ShowResult = ShowResult.Yes;
                        Close();
                        Toast("部门提交成功!", ToastLength.SHORT);
                    }
                }
                else
                {
                    //ShowResult = ShowResult.Yes;

                    frmDepAssignUser frmDepAssignUser = new frmDepAssignUser();
                    frmDepAssignUser.department = department;
                    //Show(frmDepAssignUser);
                    Show(frmDepAssignUser, (MobileForm form, object args) =>
                    {
                        if (frmDepAssignUser.ShowResult == ShowResult.Yes)
                        {
                            ShowResult = ShowResult.Yes;
                            Close();
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message, ToastLength.SHORT);
            }
        }