Exemplo n.º 1
0
 /// <summary>
 /// 修改时显示部门信息
 /// </summary>
 private void ShowDepartInfo()
 {
     if (Request.QueryString["departId"] != null)
     {
         int    departId = Convert.ToInt32(Request.QueryString["departId"]);
         Depart depart   = DepartInfoService.GetDepartGetById(departId);
         this.txtDepartName.Text      = depart.DepartName;
         this.txtConnectTelNo.Text    = depart.ConnectTelNo.ToString();
         this.txtMobileTelNo.Text     = depart.ConnectMobileTelNo.ToString();
         this.txtPricipalUser.Text    = depart.PrincipalUser.UserName.ToString();
         this.ddlBranch.SelectedValue = depart.Branch.BranchId.ToString();
         this.txtFaxes.Text           = depart.Faxes.ToString();
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// 保存按钮
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (Request.QueryString["departId"] != null)
            {
                //修改

                User   user = UserManager.GetUserByUserName(this.txtPricipalUser.Text);
                Depart item = new Depart();
                item.DepartName           = this.txtDepartName.Text;
                item.PrincipalUser.UserId = user.UserId.ToString();
                item.Branch.BranchId      = Convert.ToInt32(this.ddlBranch.SelectedValue);
                item.ConnectMobileTelNo   = long.Parse(this.txtMobileTelNo.Text);
                item.ConnectTelNo         = long.Parse(this.txtConnectTelNo.Text);
                item.Faxes    = long.Parse(this.txtFaxes.Text);
                item.DepartId = Convert.ToInt32(Request.QueryString["departId"]);
                DepartInfoService.UpdateDepart(item);
            }
            else
            {
                //添加

                User   user = UserManager.GetUserByUserName(this.txtPricipalUser.Text);
                Depart item = new Depart();
                item.DepartName           = this.txtDepartName.Text;
                item.PrincipalUser.UserId = user.UserId.ToString();
                item.Branch.BranchId      = Convert.ToInt32(this.ddlBranch.SelectedValue);
                item.ConnectMobileTelNo   = long.Parse(this.txtMobileTelNo.Text);
                item.ConnectTelNo         = long.Parse(this.txtConnectTelNo.Text);
                item.Faxes = long.Parse(this.txtFaxes.Text);
                DepartInfoService.AddDepart(item);
            }
        }
        catch (Exception ex)
        {
            ex.Message.ToString();
        }
        finally
        {
            Response.Redirect("DepartManage.aspx");
        }
    }
Exemplo n.º 3
0
 /// <summary>
 /// 修改、删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void gvDepartInfo_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         try
         {
             int departId = Convert.ToInt32(e.CommandArgument.ToString());
             DepartInfoService.DeleteDepart(departId);
         }
         catch (Exception ex)
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "key", "alert('请先删除外键中的数据!')", true);
         }
         BindDepartInfo();
     }
     if (e.CommandName == "Update")
     {
         int departId = Convert.ToInt32(e.CommandArgument.ToString());
         Response.Redirect("SaveDepart.aspx?departId=" + departId);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 根据机构ID查找对象集合
 /// </summary>
 /// <param name="branchId"></param>
 /// <returns></returns>
 public static IList <Depart> GetDeparByBranchId(int branchId)
 {
     return(DepartInfoService.GetDeparByBranchId(branchId));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 删除部门信息
 /// </summary>
 /// <param name="departId"></param>
 /// <returns></returns>
 public static int DeleteDepart(int departId)
 {
     return(DepartInfoService.DeleteDepart(departId));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 修改部门信息
 /// </summary>
 /// <param name="depart"></param>
 /// <returns></returns>
 public static int UpdateDepart(Depart depart)
 {
     return(DepartInfoService.UpdateDepart(depart));
 }
Exemplo n.º 7
0
 /// <summary>
 /// 查询所有部门信息
 /// </summary>
 /// <returns></returns>
 public static IList <Depart> GetAllDepart()
 {
     return(DepartInfoService.GetAllDepart());
 }
Exemplo n.º 8
0
 /// <summary>
 /// 根据部门ID查询所有信息
 /// </summary>
 /// <param name="departId"></param>
 /// <returns></returns>
 public static Depart GetDepartGetById(int departId)
 {
     return(DepartInfoService.GetDepartGetById(departId));
 }
Exemplo n.º 9
0
 /// <summary>
 /// 添加部门信息
 /// </summary>
 /// <param name="depart"></param>
 /// <returns></returns>
 public static Depart AddDepart(Depart depart)
 {
     return(DepartInfoService.AddDepart(depart));
 }