private void fill() { try { switch (type.ToLower()) { case "posi": Song.Entities.Position p = Business.Do <IPosition>().GetSingle(id); ltName.Text = p.Posi_Name; break; case "group": Song.Entities.EmpGroup e = Business.Do <IEmpGroup>().GetSingle(id); ltName.Text = e.EGrp_Name; break; case "depart": Song.Entities.Depart d = Business.Do <IDepart>().GetSingle(id); ltName.Text = d.Dep_CnName; break; } } catch (Exception ex) { Message.ExceptionShow(ex); } }
/// <summary> /// 设置初始界面 /// </summary> private void fill() { try { Song.Entities.Position mm; if (id != 0) { mm = Business.Do <IPosition>().GetSingle(id); } else { //如果是新增 mm = new Song.Entities.Position(); mm.Posi_IsUse = true; } tbName.Text = mm.Posi_Name; //是否显示 cbIsUse.Checked = mm.Posi_IsUse; if (mm.Posi_IsAdmin) { cbIsUse.Enabled = false; } //说明 tbIntro.Text = mm.Posi_Intro; } catch (Exception ex) { Message.ExceptionShow(ex); } }
protected void Page_Load(object sender, EventArgs e) { Song.Entities.Position super = Business.Do <IPosition>().GetAdmin(id); superid = super.Posi_Id.ToString(); if (!this.IsPostBack) { BindData(null, null); } }
protected void Page_Load(object sender, EventArgs e) { this.Form.DefaultButton = this.btnSear.UniqueID; Song.Entities.Position super = Business.Do <IPosition>().GetSuper(); superid = super.Posi_Id.ToString(); if (!this.IsPostBack) { BindData(null, null); } }
/// <summary> /// 修改 /// </summary> /// <param name="entity">业务实体</param> public void Save(EmpAccount entity) { try { //解析身份证信息,取年龄、性别等 IDCardNumber card = IDCardNumber.Get(entity.Acc_IDCardNumber); entity.Acc_Age = card.Birthday.Year; entity.Acc_Sex = card.Sex; entity.Acc_Birthday = card.Birthday; } catch { } //员所在院系,与所处岗位 Song.Entities.Depart dep = Gateway.Default.From <Depart>().Where(Depart._.Dep_Id == entity.Dep_Id).ToFirst <Depart>(); if (dep != null) { entity.Dep_CnName = dep.Dep_CnName; } Song.Entities.Position pos = Gateway.Default.From <Position>().Where(Position._.Posi_Id == entity.Posi_Id).ToFirst <Position>(); if (pos != null) { entity.Posi_Name = pos.Posi_Name; } using (DbTrans tran = Gateway.Default.BeginTrans()) { try { //当修改员工帐号时 tran.Save <EmpAccount>(entity); //tran.Update<Picture>(new Field[] { Picture._.Acc_Name }, new object[] { entity.Acc_Name }, Picture._.Acc_Id == entity.Acc_Id,tran); //Gateway.Default.Update<Product>(new Field[] { Product._.Acc_Name }, new object[] { entity.Acc_Name }, Product._.Acc_Id == entity.Acc_Id,tran); tran.Update <Article>(new Field[] { Article._.Acc_Name }, new object[] { entity.Acc_Name }, Article._.Acc_Id == entity.Acc_Id); //Gateway.Default.Update<Video>(new Field[] { Video._.Acc_Name }, new object[] { entity.Acc_Name }, Video._.Acc_Id == entity.Acc_Id); //Gateway.Default.Update<Download>(new Field[] { Download._.Acc_Name }, new object[] { entity.Acc_Name }, Download._.Acc_Id == entity.Acc_Id); //工作日志的信息 tran.Update <DailyLog>(new Field[] { DailyLog._.Acc_Name }, new object[] { entity.Acc_Name }, DailyLog._.Acc_Id == entity.Acc_Id); //任务管理 tran.Update <Task>(new Field[] { Task._.Acc_Name }, new object[] { entity.Acc_Name }, Task._.Acc_Id == entity.Acc_Id); tran.Update <Task>(new Field[] { Task._.Task_WorkerName }, new object[] { entity.Acc_Name }, Task._.Task_WorkerId == entity.Acc_Id); tran.Commit(); } catch (Exception ex) { tran.Rollback(); throw ex; } finally { tran.Close(); } } }
private void fill() { try { EmpAccount ea = this.currentUser; //员工帐号 this.lbAcc.Text = ea.Acc_AccName; //员工名称 this.lbName.Text = ea.Acc_Name; this.lbEmpCode.Text = ea.Acc_EmpCode; this.lbEmail.Text = ea.Acc_Email; this.lbRegTime.Text = ((DateTime)ea.Acc_RegTime).ToString("yyyy年M月d日"); //院系 Song.Entities.Depart depart = Business.Do <IDepart>().GetSingle((int)ea.Dep_Id); if (depart != null) { lbDepart.Text = depart.Dep_CnName; } //角色 Song.Entities.Position posi = Business.Do <IPosition>().GetSingle((int)ea.Posi_Id); if (posi != null) { lbPosi.Text = posi.Posi_Name; } //用户组 Song.Entities.EmpGroup[] egs = Business.Do <IEmpGroup>().GetAll4Emp(ea.Acc_Id); if (egs != null) { for (int i = 0; i < egs.Length; i++) { if (i == egs.Length - 1) { lbGroup.Text += egs[i].EGrp_Name; } else { lbGroup.Text += egs[i].EGrp_Name + ","; } } } } catch (Exception ex) { Message.ExceptionShow(ex); } // }
private void fill() { EmpAccount ea = Extend.LoginState.Admin.CurrentUser; //员工帐号 this.lbAcc.Text = ea.Acc_AccName; //员工名称 this.tbName.Text = ea.Acc_Name; tbNamePinjin.Text = ea.Acc_NamePinyin; this.lbEmpCode.Text = ea.Acc_EmpCode; //性别 string sex = ea.Acc_Sex.ToString().ToLower(); ListItem liSex = rbSex.Items.FindByValue(sex); if (liSex != null) { liSex.Selected = true; } //院系 Song.Entities.Depart depart = Business.Do <IDepart>().GetSingle(ea.Dep_Id); if (depart != null) { lbDepart.Text = depart.Dep_CnName; } //角色 Song.Entities.Position posi = Business.Do <IPosition>().GetSingle((int)ea.Posi_Id); if (posi != null) { lbPosi.Text = posi.Posi_Name; } //职位(头衔) lbTeam.Text = ea.Team_Name; //联系方式 tbTel.Text = ea.Acc_Tel; cbIsOpenTel.Checked = ea.Acc_IsOpenTel; tbMobile.Text = ea.Acc_MobileTel; cbIsOpenMobile.Checked = ea.Acc_IsOpenMobile; tbEmail.Text = ea.Acc_Email; tbQQ.Text = ea.Acc_QQ; tbWeixin.Text = ea.Acc_Weixin; //个人照片 if (!string.IsNullOrEmpty(ea.Acc_Photo) && ea.Acc_Photo.Trim() != "") { this.imgShow.Src = Upload.Get[_uppath].Virtual + ea.Acc_Photo; } }
protected void Page_Load(object sender, EventArgs e) { try { this.Form.DefaultButton = ""; if (!this.IsPostBack) { Song.Entities.Position super = Business.Do <IPosition>().GetSuper(); superid = super.Posi_Id.ToString(); ddlDepartBind(); BindData(null, null); } } catch (Exception ex) { Message.ExceptionShow(ex); } }
/// <summary> /// 修改是否显示的状态 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void sbAdmin_Click(object sender, EventArgs e) { try { StateButton ub = (StateButton)sender; int index = ((GridViewRow)(ub.Parent.Parent)).RowIndex; //获取员工id int accid = int.Parse(this.GridView1.DataKeys[index].Value.ToString()); Song.Entities.EmpAccount entity = Business.Do <IEmployee>().GetSingle(accid); //分厂的管理岗位 Song.Entities.Position posi = Business.Do <IPosition>().GetAdmin(id); entity.Posi_Id = posi.Posi_Id; entity.Posi_Name = posi.Posi_Name; Business.Do <IEmployee>().Save(entity); BindData(null, null); } catch (Exception ex) { Message.ExceptionShow(ex); } }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEnter_Click(object sender, EventArgs e) { try { Song.Entities.Position mm; if (id != 0) { mm = Business.Do <IPosition>().GetSingle(id); } else { //如果是新增 mm = new Song.Entities.Position(); mm.Posi_IsUse = true; } //属性 mm.Posi_Name = tbName.Text; mm.Posi_IsUse = cbIsUse.Checked; //说明 mm.Posi_Intro = tbIntro.Text; //确定操作 if (id == 0) { Song.Entities.EmpAccount acc = Extend.LoginState.Admin.CurrentUser; mm.Org_ID = acc.Org_ID; mm.Org_Name = acc.Org_Name; Business.Do <IPosition>().Add(mm); } else { Business.Do <IPosition>().Save(mm); } Master.AlertCloseAndRefresh("操作成功!"); } catch (Exception ex) { Message.ExceptionShow(ex); } }
private void fill() { try { //输出所有员工 int orgid = Extend.LoginState.Admin.CurrentUser.Org_ID; Song.Entities.EmpAccount[] ea = Business.Do <IEmployee>().GetAll(orgid, -1, true, ""); rtEmp.DataSource = ea; rtEmp.DataBind(); //显示当前角色名 Song.Entities.Position p = Business.Do <IPosition>().GetSingle(id); this.lbPosi.Text = p.Posi_Name; //输出隶属当前角色的所有员工 Song.Entities.EmpAccount[] emp4posi = Business.Do <IPosition>().GetAllEmplyee(id); rbEmp4Posi.DataSource = emp4posi; rbEmp4Posi.DataBind(); } catch (Exception ex) { Message.ExceptionShow(ex); } }
/// <summary> /// 修改是否显示的状态 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void sbShow_Click(object sender, EventArgs e) { try { StateButton ub = (StateButton)sender; int index = ((GridViewRow)(ub.Parent.Parent)).RowIndex; int id = int.Parse(this.GridView1.DataKeys[index].Value.ToString()); //判断是否有员工 Song.Entities.EmpAccount[] acc = Business.Do <IPosition>().GetAllEmplyee(id); if (acc.Length > 0) { throw new WeiSha.Common.ExceptionForAlert("当前岗位下有员工,不得禁用!"); } // Song.Entities.Position entity = Business.Do <IPosition>().GetSingle(id); entity.Posi_IsUse = !entity.Posi_IsUse; Business.Do <IPosition>().Save(entity); BindData(null, null); } catch (Exception ex) { this.Alert(ex.Message); } }
private void fill() { try { switch (type.ToLower()) { case "posi": Song.Entities.Position p = Business.Do <IPosition>().GetSingle(id); ltName.Text = p.Posi_Name; break; case "group": Song.Entities.EmpGroup e = Business.Do <IEmpGroup>().GetSingle(id); ltName.Text = e.EGrp_Name; break; case "depart": Song.Entities.Depart d = Business.Do <IDepart>().GetSingle(id); ltName.Text = d.Dep_CnName; break; case "organ": ltName.Text = "所有机构"; break; case "orglevel": Song.Entities.OrganLevel lv = Business.Do <IOrganization>().LevelSingle(id); ltName.Text = "机构等级:" + lv.Olv_Name; break; } } catch (Exception ex) { Message.ExceptionShow(ex); } }
/// <summary> /// 删除,按主键ID; /// </summary> /// <param name="identify">实体的主键</param> public void Delete(int identify) { Song.Entities.Position entity = this.GetSingle(identify); this.Delete(entity); }
/// <summary> /// 删除,按职位名称 /// </summary> /// <param name="name">职位名称</param> public void Delete(int orgid, string name) { Song.Entities.Position entity = this.GetSingle(orgid, name); this.Delete(entity); }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEnter_Click(object sender, EventArgs e) { EmpAccount ea = Business.Do <IEmployee>().GetAdminByOrgId(id); if (ea == null) { Song.Entities.Position posi = Business.Do <IPosition>().GetAdmin(id); ea = new EmpAccount(); ea.Posi_Id = posi.Posi_Id; ea.Posi_Name = posi.Posi_Name; } if (tbAccName.Text.Trim() == "") { ea.Acc_AccName = WeiSha.Common.Request.UniqueID(); } else { ea.Acc_AccName = tbAccName.Text; } ea.Acc_Name = tbName.Text; ea.Acc_MobileTel = tbMobile.Text; ea.Acc_Sex = short.Parse(rbSex.SelectedValue); ea.Acc_Age = string.IsNullOrWhiteSpace(tbAge.Text.Trim()) ? DateTime.Now.AddYears(-1000).Year : DateTime.Now.AddYears(-Convert.ToInt32(tbAge.Text)).Year; ea.Acc_IDCardNumber = tbIdCard.Text; ea.Acc_IsUse = true; Song.Entities.Organization org = Business.Do <IOrganization>().OrganSingle(id); if (org != null) { ea.Org_Name = org.Org_Name; ea.Org_ID = org.Org_ID; } try { bool isExists = Business.Do <IEmployee>().IsExists(org.Org_ID, ea); if (isExists) { Master.Alert("当前帐号已经存在!"); return; } if (ea.Acc_Id < 1) { //密码 ea.Acc_Pw = tbPw.Text.Trim(); Business.Do <IEmployee>().Add(ea); } else { if (!string.IsNullOrWhiteSpace(tbPw.Text.Trim())) { ea.Acc_Pw = new WeiSha.Common.Param.Method.ConvertToAnyValue(tbPw.Text.Trim()).MD5; } Business.Do <IEmployee>().Save(ea); } Master.AlertCloseAndRefresh("操作成功!"); } catch (Exception ex) { Master.Alert(ex.Message); } }