Esempio n. 1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEnter_Click(object sender, EventArgs e)
        {
            Song.Entities.Organization org = Business.Do <IOrganization>().OrganCurrent();
            if (org == null)
            {
                throw new WeiSha.Common.ExceptionForAlert("当前机构不存在");
            }
            Song.Entities.Depart dep = id == 0 ? new Song.Entities.Depart() : Business.Do <IDepart>().GetSingle(id);
            dep = this.EntityFill(dep) as Song.Entities.Depart;
            //判断是否重名
            if (Business.Do <IDepart>().IsExist(org.Org_ID, dep))
            {
                Master.Alert("当前数据已经存在!");
            }
            else
            {
                try
                {
                    if (id == 0)
                    {
                        Business.Do <IDepart>().Add(dep);
                    }
                    else
                    {
                        Business.Do <IDepart>().Save(dep);
                    }

                    Master.AlertCloseAndRefresh("操作成功!");
                }
                catch (Exception ex)
                {
                    Master.Alert(ex.Message);
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 如果是修改模式,设置指派给哪个员工,且该员工所处的院系
 /// </summary>
 /// <param name="accid">员工Id</param>
 private void setDepart(int accid)
 {
     try
     {
         ddlDepart.SelectedIndex = -1;
         //设置院系
         Song.Entities.Depart dep = Business.Do <IEmployee>().Get4Depart(accid);
         if (dep == null)
         {
             ddlDepart.Items.FindByValue("-1").Selected = true;
             return;
         }
         ListItem liDepart = ddlDepart.Items.FindByValue(dep.Dep_Id.ToString());
         if (liDepart != null)
         {
             liDepart.Selected = true;
             ddlDepart_SelectedIndexChanged(null, null);
         }
         //设定员工
         ListItem li = ddlEmployee.Items.FindByValue(accid.ToString());
         if (li != null)
         {
             ddlEmployee.SelectedIndex = -1;
             li.Selected = true;
         }
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
 public void TeamSave(Team entity)
 {
     //
     Song.Entities.Depart dep = Gateway.Default.From <Depart>().Where(Depart._.Dep_Id == entity.Dep_ID).ToFirst <Depart>();
     if (dep != null)
     {
         entity.Dep_Name = dep.Dep_CnName;
     }
     using (DbTrans tran = Gateway.Default.BeginTrans())
     {
         try
         {
             tran.Save <Team>(entity);
             tran.Update <EmpAccount>(new Field[] { EmpAccount._.Team_Name }, new object[] { entity.Team_Name }, EmpAccount._.Team_ID == entity.Team_ID);
             tran.Commit();
         }
         catch (Exception ex)
         {
             tran.Rollback();
             throw ex;
         }
         finally
         {
             tran.Close();
         }
     }
 }
Esempio n. 5
0
 /// <summary>
 /// 获取院系id
 /// </summary>
 /// <param name="depart"></param>
 /// <param name="departName"></param>
 /// <returns></returns>
 private int _getDepartId(Song.Entities.Depart[] depart, string sortName)
 {
     try
     {
         int sortId = 0;
         foreach (Song.Entities.Depart s in depart)
         {
             if (sortName.Trim() == s.Dep_CnName)
             {
                 sortId = s.Dep_Id;
                 break;
             }
         }
         if (sortId == 0 && sortName.Trim() != "")
         {
             Song.Entities.Depart nwsort = new Song.Entities.Depart();
             nwsort.Dep_CnName = sortName;
             nwsort.Dep_IsUse  = true;
             nwsort.Dep_IsShow = true;
             sortId            = Business.Do <IDepart>().Add(nwsort);
             int orgid = Extend.LoginState.Admin.CurrentUser.Org_ID;
             this.departs = Business.Do <IDepart>().GetAll(orgid, null, null);
         }
         return(sortId);
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
         return(0);
     }
 }
Esempio n. 6
0
        protected void sbUse_Click(object sender, EventArgs e)
        {
            StateButton ub    = (StateButton)sender;
            int         index = ((GridViewRow)(ub.Parent.Parent)).RowIndex;
            int         id    = int.Parse(this.GridView1.DataKeys[index].Value.ToString());

            //
            Song.Entities.Depart entity = Business.Do <IDepart>().GetSingle(id);
            entity.Dep_IsUse = !entity.Dep_IsUse;
            Business.Do <IDepart>().Save(entity);
            BindData(null, null);
        }
Esempio n. 7
0
 /// <summary>
 /// 设置初始界面
 /// </summary>
 private void fill()
 {
     Song.Entities.Depart dep = id == 0 ? new Song.Entities.Depart() : Business.Do <IDepart>().GetSingle(id);
     if (dep == null)
     {
         return;
     }
     if (dep != null)
     {
         this.EntityBind(dep);
     }
 }
Esempio n. 8
0
 /// <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();
         }
     }
 }
Esempio n. 9
0
        public void SubjectSave(Subject entity)
        {
            //专业的id与pid不能相等
            if (entity.Sbj_PID == entity.Sbj_ID)
            {
                throw new Exception("Subject table PID Can not be equal to ID");
            }
            Subject old = SubjectSingle(entity.Sbj_ID);

            if (old.Sbj_PID != entity.Sbj_PID)
            {
                object obj = Gateway.Default.Max <Subject>(Subject._.Sbj_Tax, Subject._.Org_ID == entity.Org_ID && Subject._.Sbj_PID == entity.Sbj_PID);
                entity.Sbj_Tax = obj is int?(int)obj + 1 : 0;
            }
            entity.Sbj_Level = _ClacLevel(entity);
            entity.Sbj_XPath = _ClacXPath(entity);
            if (entity.Dep_Id > 0)
            {
                Song.Entities.Depart depart = Gateway.Default.From <Depart>().Where(Depart._.Dep_Id == entity.Dep_Id).ToFirst <Depart>();
                if (depart != null)
                {
                    entity.Dep_CnName = depart.Dep_CnName;
                }
            }
            using (DbTrans tran = Gateway.Default.BeginTrans())
            {
                try
                {
                    tran.Save <Subject>(entity);
                    tran.Update <Questions>(new Field[] { Questions._.Sbj_Name }, new object[] { entity.Sbj_Name }, Questions._.Sbj_ID == entity.Sbj_ID);
                    tran.Update <Course>(new Field[] { Course._.Sbj_Name }, new object[] { entity.Sbj_Name }, Course._.Sbj_ID == entity.Sbj_ID);
                    tran.Update <TestPaper>(new Field[] { TestPaper._.Sbj_Name }, new object[] { entity.Sbj_Name }, TestPaper._.Sbj_ID == entity.Sbj_ID);
                    tran.Update <TestResults>(new Field[] { TestResults._.Sbj_Name }, new object[] { entity.Sbj_Name }, TestResults._.Sbj_ID == entity.Sbj_ID);
                    tran.Update <Examination>(new Field[] { Examination._.Sbj_Name }, new object[] { entity.Sbj_Name }, Examination._.Sbj_ID == entity.Sbj_ID);
                    tran.Update <ExamResults>(new Field[] { ExamResults._.Sbj_Name }, new object[] { entity.Sbj_Name }, ExamResults._.Sbj_ID == entity.Sbj_ID);
                    tran.Commit();
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    throw ex;
                }
                finally
                {
                    tran.Close();
                }
            }
        }
Esempio n. 10
0
 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);
     }
     //
 }
Esempio n. 11
0
        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;
            }
        }
Esempio n. 12
0
 /// <summary>
 /// 修改院系排序
 /// </summary>
 /// <param name="xml"></param>
 public void SaveOrder(string xml)
 {
     using (DbTrans tran = Gateway.Default.BeginTrans())
     {
         try
         {
             XmlDocument resXml = new XmlDocument();
             resXml.XmlResolver = null;
             resXml.LoadXml(xml, false);
             XmlNodeList nodeList = resXml.SelectSingleNode("nodes").ChildNodes;
             //取rootid
             XmlNode    nodes   = resXml.SelectSingleNode("nodes");
             XmlElement xenodes = (XmlElement)nodes;
             //遍历所有子节点
             foreach (XmlNode xn in nodeList)
             {
                 XmlElement           xe    = (XmlElement)xn;
                 int                  id    = Convert.ToInt32(xe.Attributes["id"].Value);
                 int                  pid   = Convert.ToInt32(xe.Attributes["pid"].Value);
                 int                  tax   = Convert.ToInt32(xe.Attributes["tax"].Value);
                 bool                 state = Convert.ToBoolean(xe.Attributes["state"].Value);
                 Song.Entities.Depart dep   = this.GetSingle(id);
                 if (dep != null)
                 {
                     dep.Dep_PatId = pid;
                     dep.Dep_Tax   = tax;
                     dep.Dep_State = state;
                     tran.Save <Depart>(dep);
                 }
             }
             tran.Commit();
         }
         catch (Exception ex)
         {
             tran.Rollback();
             throw ex;
         }
         finally
         {
             tran.Close();
         }
     }
 }
Esempio n. 13
0
        /// <summary>
        /// 添加院系信息
        /// </summary>
        /// <param name="result"></param>
        private void _Add(string result)
        {
            if (result == "" || result == null)
            {
                return;
            }
            XmlDocument resXml = new XmlDocument();

            try
            {
                resXml.LoadXml(result, false);
                XmlNode node             = resXml.SelectSingleNode("node");
                int     id               = Convert.ToInt32(((XmlElement)node).Attributes["id"].Value);
                Song.Entities.Depart dep = new Song.Entities.Depart();
                dep.Dep_CnName = ((XmlElement)node.SelectSingleNode("name")).InnerText;
                string pid = ((XmlElement)node.SelectSingleNode("pid")).InnerText;
                dep.Dep_PatId    = string.IsNullOrWhiteSpace(pid) ? 0 : Convert.ToInt32(pid);
                dep.Dep_CnAbbr   = ((XmlElement)node.SelectSingleNode("CnAbbr")).InnerText;
                dep.Dep_EnName   = ((XmlElement)node.SelectSingleNode("enname")).InnerText;
                dep.Dep_EnAbbr   = ((XmlElement)node.SelectSingleNode("EnAbbr")).InnerText;
                dep.Dep_Code     = ((XmlElement)node.SelectSingleNode("code")).InnerText;
                dep.Dep_IsShow   = Convert.ToBoolean(((XmlElement)node.SelectSingleNode("IsShow")).InnerText);
                dep.Dep_IsUse    = Convert.ToBoolean(((XmlElement)node.SelectSingleNode("IsUse")).InnerText);
                dep.Dep_Func     = ((XmlElement)node.SelectSingleNode("func")).InnerText;
                dep.Dep_Phone    = ((XmlElement)node.SelectSingleNode("phone")).InnerText;
                dep.Dep_Fax      = ((XmlElement)node.SelectSingleNode("fax")).InnerText;
                dep.Dep_Email    = ((XmlElement)node.SelectSingleNode("email")).InnerText;
                dep.Dep_Msn      = ((XmlElement)node.SelectSingleNode("msn")).InnerText;
                dep.Dep_WorkAddr = ((XmlElement)node.SelectSingleNode("WorkAddr")).InnerText;
                //所属机构
                int orgid = Extend.LoginState.Admin.CurrentUser.Org_ID;
                dep.Org_ID = orgid;
                //赋值
                Business.Do <IDepart>().Add(dep);
            }
            catch
            {
            }
        }
Esempio n. 14
0
 public int TeamAdd(Team entity)
 {
     entity.Team_CrtTime = DateTime.Now;
     //如果没有排序号,则自动计算
     if (entity.Team_Tax < 1)
     {
         object obj = Gateway.Default.Max <Team>(Team._.Team_Tax, Team._.Team_ID > -1);
         entity.Team_Tax = obj is int?(int)obj + 1 : 0;
     }
     Song.Entities.Depart dep = Gateway.Default.From <Depart>().Where(Depart._.Dep_Id == entity.Dep_ID).ToFirst <Depart>();
     if (dep != null)
     {
         entity.Dep_Name = dep.Dep_CnName;
     }
     Song.Entities.Organization org = Business.Do <IOrganization>().OrganCurrent();
     if (org != null)
     {
         entity.Org_ID   = org.Org_ID;
         entity.Org_Name = org.Org_Name;
     }
     return(Gateway.Default.Save <Team>(entity));
 }
Esempio n. 15
0
        /// <summary>
        /// 修改院系信息
        /// </summary>
        /// <param name="result"></param>
        private void _Update(string result)
        {
            if (result == "" || result == null)
            {
                return;
            }
            XmlDocument resXml = new XmlDocument();

            try
            {
                resXml.LoadXml(result, false);
                XmlNode node             = resXml.SelectSingleNode("node");
                int     id               = Convert.ToInt32(((XmlElement)node).Attributes["id"].Value);
                Song.Entities.Depart dep = Business.Do <IDepart>().GetSingle(id);
                if (dep == null)
                {
                    return;
                }
                dep.Dep_CnName   = ((XmlElement)node.SelectSingleNode("name")).InnerText;
                dep.Dep_CnAbbr   = ((XmlElement)node.SelectSingleNode("CnAbbr")).InnerText;
                dep.Dep_EnName   = ((XmlElement)node.SelectSingleNode("enname")).InnerText;
                dep.Dep_EnAbbr   = ((XmlElement)node.SelectSingleNode("EnAbbr")).InnerText;
                dep.Dep_Code     = ((XmlElement)node.SelectSingleNode("code")).InnerText;
                dep.Dep_IsShow   = Convert.ToBoolean(((XmlElement)node.SelectSingleNode("IsShow")).InnerText);
                dep.Dep_IsUse    = Convert.ToBoolean(((XmlElement)node.SelectSingleNode("IsUse")).InnerText);
                dep.Dep_Func     = ((XmlElement)node.SelectSingleNode("func")).InnerText;
                dep.Dep_Phone    = ((XmlElement)node.SelectSingleNode("phone")).InnerText;
                dep.Dep_Fax      = ((XmlElement)node.SelectSingleNode("fax")).InnerText;
                dep.Dep_Email    = ((XmlElement)node.SelectSingleNode("email")).InnerText;
                dep.Dep_Msn      = ((XmlElement)node.SelectSingleNode("msn")).InnerText;
                dep.Dep_WorkAddr = ((XmlElement)node.SelectSingleNode("WorkAddr")).InnerText;
                //赋值
                Business.Do <IDepart>().Save(dep);
            }
            catch
            {
            }
        }
Esempio n. 16
0
 /// <summary>
 /// 设置初始界面
 /// </summary>
 private void fill()
 {
     try
     {
         if (id < 1)
         {
             return;
         }
         Song.Entities.Task mm;
         mm = Business.Do <ITask>().GetSingle(id);
         //任务名称
         lbName.Text = mm.Task_Name;
         //优先级
         lbLevel.Text = mm.Task_Level.ToString();
         //指派人信息
         lbWorkerName.Text = mm.Task_WorkerName;
         Song.Entities.Depart dep = Business.Do <IEmployee>().Get4Depart((int)mm.Task_WorkerId);
         if (dep != null)
         {
             lbDepart.Text = dep.Dep_CnName;
         }
         //任务内容
         lbContext.Text = mm.Task_Context.Replace("\n", "<br/>");
         //开始时间与计划结束时间
         lbStart.Text = ((DateTime)mm.Task_StartTime).ToString("yyyy-MM-dd");
         lbEnd.Text   = ((DateTime)mm.Task_EndTime).ToString("yyyy-MM-dd");
         //工作记录
         tbWorkLog.Text = mm.Task_WorkLog;
         //退回的原因
         tbGoBackText.Text = mm.Task_GobackText;
         //完成度
         tbCompletePer.Text = mm.Task_CompletePer.ToString();
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Esempio n. 17
0
        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);
            }
        }