Ejemplo n.º 1
0
        /// <summary>
        /// 写入当前用户
        /// </summary>
        public void Write()
        {
            //先读取当前用户,再写入
            EmpAccount ea = this.Read();

            this.Write(ea);
        }
Ejemplo n.º 2
0
 void setPlan()
 {
     try
     {
         //原计划;
         EmpAccount acc = Extend.LoginState.Admin.CurrentUser;
         //取当前工作记录的上一个记录
         Song.Entities.DailyLog pre = Business.Do <IDailyLog>().GetPrevious(Convert.ToDateTime(tbTime.Text.Trim()), rblType.SelectedItem.Text, acc.Acc_Id);
         //如果不存在
         if (pre == null)
         {
             divPlan.Visible = false;
         }
         else
         {
             //如果上一个记录没有填写计划
             if (pre.Dlog_Plan.Trim() == "")
             {
                 divPlan.Visible = false;
             }
             else
             {
                 divPlan.Visible = true;
                 ltPlan.Text     = pre.Dlog_Plan.Replace("\n", "<br/>");
             }
         }
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity">业务实体</param>
        public void Delete(EmpAccount entity)
        {
            if (entity == null)
            {
                return;
            }
            //如果用户属于超管角色,则不允许删除
            Position p = Gateway.Default.From <Position>().Where(Position._.Posi_Id == entity.Posi_Id).ToFirst <Position>();

            if (p != null && p.Posi_IsAdmin == true)
            {
                throw new Exception("管理员不可以删除!");
            }
            //删除与用户组的关联
            using (DbTrans tran = Gateway.Default.BeginTrans())
            {
                try
                {
                    tran.Delete <EmpAcc_Group>(EmpAcc_Group._.Acc_Id == entity.Acc_Id);
                    tran.Delete <EmpAccount>(entity);
                    WeiSha.WebControl.FileUpload.Delete("Employee", entity.Acc_Photo);
                    tran.Commit();
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    throw ex;
                }
                finally
                {
                    tran.Close();
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 注册某个用户到在线列表中
        /// </summary>
        /// <param name="acc"></param>
        private void _register(Song.Entities.EmpAccount acc)
        {
            if (acc == null)
            {
                return;
            }
            //登录时间,该时间不入数据库,仅为临时使用
            acc.Acc_LastTime = DateTime.Now;
            //登录用户是否已经存在;
            bool isHav = false;

            for (int i = 0; i < this._onlineUser.Count; i++)
            {
                EmpAccount e = this._onlineUser[i];
                if (e == null)
                {
                    continue;
                }
                if (e.Acc_Id == acc.Acc_Id)
                {
                    this._onlineUser[i] = acc;
                    isHav = true;
                    break;
                }
            }
            //如果未登录,则注册进去
            if (!isHav)
            {
                this.OnlineUserAdd(acc);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEnter_Click(object sender, EventArgs e)
 {
     try
     {
         if (currentUser == null)
         {
             return;
         }
         EmpAccount obj  = currentUser;
         string     name = obj.Acc_AccName;
         string     pw   = this.tbOldPw.Text.Trim();
         obj = Business.Do <IEmployee>().GetSingle(name, pw);
         this.lbShow.Visible = obj == null;
         if (obj == null)
         {
             return;
         }
         //员工登录密码,为空
         if (tbPw1.Text != "")
         {
             string md5 = WeiSha.Common.Request.Controls[tbPw1].MD5;
             obj.Acc_Pw = md5;
         }
         Business.Do <IEmployee>().Save(obj);
         Master.AlertAndClose("操作成功!");
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        protected void BindData(object sender, EventArgs e)
        {
            try
            {
                //总记录数
                int count = 0;
                //当前选择的栏目id
                string type = ddlTpye.SelectedValue;
                if (type == "-1")
                {
                    type = "";
                }
                else
                {
                    type = ddlTpye.SelectedItem.Text;
                }
                EmpAccount acc = Extend.LoginState.Admin.CurrentUser;
                List <Song.Entities.AddressList> eas = null;
                eas = Business.Do <IAddressList>().AddressPager(acc.Acc_Id, type, this.tbSear.Text, Pager1.Size, Pager1.Index, out count);
                GridView1.DataSource   = eas;
                GridView1.DataKeyNames = new string[] { "Adl_Id" };
                GridView1.DataBind();

                Pager1.RecordAmount = count;
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        protected void BindData(object sender, EventArgs e)
        {
            try
            {
                //总记录数
                int count = 0;
                //分类
                string   type  = rblType.SelectedItem.Text;
                DateTime start = DateTime.Now.AddYears(-100);
                DateTime end   = DateTime.Now.AddYears(100);
                if (tbStart.Text.Trim() != "")
                {
                    start = Convert.ToDateTime(tbStart.Text.Trim());
                }
                if (this.tbEnd.Text.Trim() != "")
                {
                    end = Convert.ToDateTime(tbEnd.Text.Trim());
                }
                Song.Entities.DailyLog[] eas = null;
                EmpAccount acc = Extend.LoginState.Admin.CurrentUser;
                eas = Business.Do <IDailyLog>().GetPager(acc.Acc_Id, type, start, end, Pager1.Size, Pager1.Index, out count);

                GridView1.DataSource   = eas;
                GridView1.DataKeyNames = new string[] { "Dlog_Id" };
                GridView1.DataBind();

                Pager1.RecordAmount = count;
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
        }
Ejemplo n.º 8
0
 private void fill()
 {
     try
     {
         Song.Entities.Subject[] sbj = Business.Do <ISubject>().SubjectCount(true, -1);
         cblSubject.DataSource     = sbj;
         cblSubject.DataTextField  = "sbj_Name";
         cblSubject.DataValueField = "sbj_id";
         cblSubject.DataBind();
         //
         EmpAccount ea  = this.currentUser;
         string     sel = Business.Do <ISystemPara>()["SubjectForAccout_" + ea.Acc_Id].String;
         if (!string.IsNullOrEmpty(sel))
         {
             foreach (string s in sel.Split(','))
             {
                 if (s == "")
                 {
                     continue;
                 }
                 ListItem li = cblSubject.Items.FindByValue(s);
                 if (li != null)
                 {
                     li.Selected = true;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Ejemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     currentUser = Extend.LoginState.Admin.CurrentUser;
     if (!this.IsPostBack)
     {
         fill();
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// 注册已经登录的在线用户,如果已经注册,则更新注册时间
        /// </summary>
        public void Register()
        {
            EmpAccount ea = this.Read();

            if (ea != null)
            {
                _register(ea);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEnter_Click(object sender, EventArgs e)
        {
            Song.Entities.Picture mm = null;
            try
            {
                if (id != 0)
                {
                    mm = Business.Do <IContents>().PictureSingle(id);
                }
                else
                {
                    //如果是新增
                    mm = new Song.Entities.Picture();
                    EmpAccount acc = Extend.LoginState.Admin.CurrentUser;
                    mm.Acc_Id   = acc.Acc_Id;
                    mm.Acc_Name = acc.Acc_Name;
                }
                mm.Pic_Name = tbName.Text;
                //是否使用与显示
                mm.Pic_IsRec  = cbIsRec.Checked;
                mm.Pic_IsShow = cbIsShow.Checked;
                //热点与置顶
                mm.Pic_IsHot = cbIsHot.Checked;
                mm.Pic_IsTop = cbIsTop.Checked;
                //说明
                mm.Pic_Intro = this.tbIntro.Text;
                //发布信息,SEO优化
                mm.Pic_Keywords = tbKeywords.Text.Trim();
                mm.Pic_Descr    = tbDescr.Text.Trim();
                tbPushTime.Text = DateTime.Now.ToString();
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
            try
            {
                //图片
                UpFile(mm);
                //确定操作
                if (id == 0)
                {
                    mm.Pic_CrtTime = DateTime.Now;
                    Business.Do <IContents>().PictureAdd(mm);
                }
                else
                {
                    Business.Do <IContents>().PictureSave(mm);
                }

                Master.AlertCloseAndRefresh("操作成功!");
            }
            catch (Exception ex)
            {
                Master.Alert(ex.Message);
            }
        }
Ejemplo n.º 12
0
        public bool IsForRoot(int identify)
        {
            if (identify < 1)
            {
                return(false);
            }
            //先获取员工对象,如果为空则返回false;
            EmpAccount ea = this.GetSingle(identify);

            Song.Entities.Organization org = Gateway.Default.From <Organization>().Where(Organization._.Org_IsRoot == true && Organization._.Org_ID == ea.Org_ID).ToFirst <Organization>();
            return(org != null);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 获取当前员工所在的院系
        /// </summary>
        /// <param name="identify"></param>
        /// <returns></returns>
        public Depart Get4Depart(int identify)
        {
            EmpAccount ea = this.GetSingle(identify);

            if (ea == null)
            {
                return(null);
            }
            Depart dep = Gateway.Default.From <Depart>().Where(Depart._.Dep_Id == ea.Dep_Id).ToFirst <Depart>();

            return(dep);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEnter_Click(object sender, EventArgs e)
        {
            try
            {
                Song.Entities.Task mm = Business.Do <ITask>().GetSingle(id);
                //任务名称
                mm.Task_Name = tbName.Text.Trim();
                //任务内容
                mm.Task_Context = tbContext.Text.Trim();
                //任务等级
                mm.Task_Level = Convert.ToInt16(ddlLevel.SelectedItem.Text);
                //计划开始时间,计划结束时间,实际结束时间
                mm.Task_StartTime = Convert.ToDateTime(tbStart.Text);
                mm.Task_EndTime   = Convert.ToDateTime(tbEnd.Text);
                if (tbComplete.Text.Trim() != "")
                {
                    mm.Task_CompleteTime = Convert.ToDateTime(tbComplete.Text);
                }
                //所属员工
                EmpAccount acc = Extend.LoginState.Admin.CurrentUser;
                mm.Acc_Id   = acc.Acc_Id;
                mm.Acc_Name = acc.Acc_Name;
                //指派给谁
                mm.Task_WorkerId = Convert.ToInt32(ddlEmployee.SelectedValue);
                //是否使用
                mm.Task_IsUse = !cbIsUse.Checked;
                //是否完成
                mm.Task_IsComplete = cbIsComplete.Checked;
                //完成度
                if (tbCompletePer.Text.Trim() != "")
                {
                    int per = Convert.ToInt16(tbCompletePer.Text);
                    per = per < 0 ? 0 : per;
                    mm.Task_CompletePer = per > 100 ? per : per;
                }
                else
                {
                    mm.Task_CompletePer = 0;
                }
                //设置没有退回
                mm.Task_IsGoback = false;
                //
                //确定操作
                Business.Do <ITask>().Save(mm);

                Master.AlertCloseAndRefresh("操作成功!");
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
        }
Ejemplo n.º 15
0
    public static void Main(string[] args)
    {
        EmpAccount e1 = new EmpAccount(107, "Donald Duck");
        EmpAccount e2 = new EmpAccount(108, "John Doe");
        EmpAccount e3 = new EmpAccount(109, "Roland Carlsson");

        e1.display();
        e2.display();
        e3.display();
        Console.WriteLine("\n");
        Console.WriteLine("Total Objects are: " + EmpAccount.count);
        Console.WriteLine("\n");
    }
Ejemplo n.º 16
0
        /// <summary>
        /// 根据公司id获取当前公司管理员。
        /// </summary>
        /// <param name="orgid"></param>
        /// <returns></returns>
        public EmpAccount GetAdminByOrgId(int orgid)
        {
            //先获取普通管理员岗位
            Position pos = Gateway.Default.From <Position>().Where(Position._.Posi_IsAdmin == true && Position._.Org_ID == orgid).ToFirst <Position>();

            if (pos == null)
            {
                return(null);
            }
            EmpAccount acc = Gateway.Default.From <EmpAccount>().Where(EmpAccount._.Posi_Id == pos.Posi_Id).OrderBy(EmpAccount._.Acc_Id.Asc).ToFirst <EmpAccount>();

            return(acc);
        }
Ejemplo n.º 17
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();
         }
     }
 }
Ejemplo n.º 18
0
        //获取当前学科下的所有试卷
        protected void Page_Load(object sender, EventArgs e)
        {
            Song.Entities.Organization org = Business.Do <IOrganization>().OrganCurrent();
            EmpAccount currentUser         = Extend.LoginState.Admin.CurrentUser;

            if (currentUser == null)
            {
                Response.Write("");
                Response.End();
                return;
            }
            //当前员所处的学科
            Song.Entities.Team team = Business.Do <ITeam>().TeamSingle((int)currentUser.Team_ID);
            if (team != null)
            {
                sbjid = (int)team.Sbj_ID;
            }
            //员工选择的每日一练的学科范围
            string sel = Business.Do <ISystemPara>()["SubjectForAccout_" + currentUser.Acc_Id].String;

            string[] arr = sel.Split(',');
            if (arr.Length > 0)
            {
                arr[arr.Length - 1] = sbjid.ToString();
            }
            //随机抽取学科
            if (arr.Length > 1)
            {
                Random rand  = new Random();
                int    index = rand.Next(0, arr.Length - 1);
                sbjid = Convert.ToInt32(arr[index]);
            }
            Song.Entities.Questions[] ques = Business.Do <IQuestions>().QuesRandom(org.Org_ID, sbjid, -1, -1, type, diff, diff, true, 1);
            string tm = "";

            if (ques.Length > 0)
            {
                Song.Entities.Questions q = ques[0];
                q  = replaceText(q);
                tm = q.ToJson();
                //如果是单选题,或多选题
                if (q.Qus_Type == 1 || q.Qus_Type == 2 || q.Qus_Type == 5)
                {
                    tm = getAnserJson(q, tm);
                }
            }

            Response.Write(tm);
            Response.End();
        }
Ejemplo n.º 19
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEnter_Click(object sender, EventArgs e)
 {
     try
     {
         if (currentUser == null)
         {
             return;
         }
         EmpAccount ea = currentUser;
         //名称与拼音缩写
         ea.Acc_Name       = tbName.Text.Trim();
         ea.Acc_NamePinyin = tbNamePinjin.Text.Trim();
         //性别
         ea.Acc_Sex = Convert.ToInt16(rbSex.SelectedValue);
         //联系方式
         ea.Acc_Tel          = tbTel.Text.Trim();
         ea.Acc_IsOpenTel    = cbIsOpenTel.Checked;
         ea.Acc_MobileTel    = tbMobile.Text.Trim();
         ea.Acc_IsOpenMobile = cbIsOpenMobile.Checked;
         ea.Acc_Email        = tbEmail.Text.Trim();
         ea.Acc_QQ           = tbQQ.Text.Trim();
         ea.Acc_Weixin       = tbWeixin.Text.Trim();
         //图片
         if (fuLoad.PostedFile.FileName != "")
         {
             try
             {
                 fuLoad.UpPath       = _uppath;
                 fuLoad.IsMakeSmall  = false;
                 fuLoad.IsConvertJpg = true;
                 fuLoad.SaveAndDeleteOld(ea.Acc_Photo);
                 fuLoad.File.Server.ChangeSize(150, 200, false);
                 ea.Acc_Photo = fuLoad.File.Server.FileName;
                 //
                 imgShow.Src = fuLoad.File.Server.VirtualPath;
             }
             catch (Exception ex)
             {
                 this.Alert(ex.Message);
             }
         }
         //
         Business.Do <IEmployee>().Save(ea);
         Master.AlertAndClose("操作成功!");
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Ejemplo n.º 20
0
        /// <summary>
        /// 当前员工是否为超级管理员
        /// </summary>
        /// <param name="identify"></param>
        /// <returns></returns>
        public bool IsSuperAdmin(int identify)
        {
            if (identify < 1)
            {
                return(false);
            }
            //先获取员工对象,如果为空则返回false;
            EmpAccount ea = this.GetSingle(identify);

            if (ea == null)
            {
                return(false);
            }
            return(IsSuperAdmin(ea));
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 通过手机号码验证,当前员工是否为在职员工
        /// </summary>
        /// <param name="phoneNumber">手机号</param>
        /// <returns></returns>
        public bool IsOnJob(string phoneNumber)
        {
            //验证员工帐号与密码
            WhereClip wc = EmpAccount._.Acc_MobileTel.Like("%" + phoneNumber + "%");

            //员工必须在职
            wc.And(EmpAccount._.Acc_IsUse == true);
            EmpAccount ac = Gateway.Default.From <EmpAccount>().Where(wc).ToFirst <EmpAccount>();

            if (ac == null)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 22
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);
     }
     //
 }
Ejemplo n.º 23
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;
            }
        }
Ejemplo n.º 24
0
        public bool IsAdmin(int identify)
        {
            if (identify < 1)
            {
                return(false);
            }
            //先获取员工对象,如果为空则返回false;
            EmpAccount ea = this.GetSingle(identify);
            //通过员工所处的岗位ID,获取岗位对象,如果岗位不存在,则返回false;
            Position p = Gateway.Default.From <Position>().Where(Position._.Posi_Id == ea.Posi_Id).ToFirst <Position>();

            if (p == null)
            {
                return(false);
            }
            return(p.Posi_IsAdmin);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 当前员工是否存在(通过帐号判断)
        /// </summary>
        /// <param name="acc"></param>
        /// <returns></returns>
        public bool IsExists(int orgid, EmpAccount acc)
        {
            WhereClip wc = new WhereClip();

            if (orgid < 1)
            {
                wc.And(EmpAccount._.Org_ID == acc.Org_ID);
            }
            else
            {
                wc.And(EmpAccount._.Org_ID == orgid);
            }
            wc.And(EmpAccount._.Acc_AccName == acc.Acc_AccName);
            int obj = Gateway.Default.Count <EmpAccount>(wc && EmpAccount._.Acc_Id != acc.Acc_Id);

            return(obj > 0);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEnter_Click(object sender, EventArgs e)
        {
            try
            {
                Song.Entities.DailyLog mm;
                if (id != 0)
                {
                    mm = Business.Do <IDailyLog>().GetSingle(id);
                }
                else
                {
                    //如果是新增
                    mm = new Song.Entities.DailyLog();
                }
                //工作记录
                mm.Dlog_Note = tbNote.Text;
                //工作计划
                mm.Dlog_Plan = tbPlan.Text;
                //分类
                mm.Dlog_Type = rblType.SelectedItem.Text;
                //写入时间
                mm.Dlog_WrtTime = Convert.ToDateTime(tbTime.Text.Trim());
                //所属员工
                EmpAccount acc = Extend.LoginState.Admin.CurrentUser;
                mm.Acc_Id   = acc.Acc_Id;
                mm.Acc_Name = acc.Acc_Name;
                //
                //确定操作
                if (id == 0)
                {
                    Business.Do <IDailyLog>().Add(mm);
                }
                else
                {
                    Business.Do <IDailyLog>().Save(mm);
                }

                Master.AlertCloseAndRefresh("操作成功!");
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
        }
Ejemplo n.º 27
0
 private void fill()
 {
     try
     {
         EmpAccount ea = currentUser;
         if (ea == null)
         {
             return;
         }
         //员工帐号
         this.lbAcc.Text = ea.Acc_AccName;
         //员工名称
         this.lbName.Text = ea.Acc_Name;
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Ejemplo n.º 28
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEnter_Click(object sender, EventArgs e)
 {
     try
     {
         Song.Entities.Notice mm;
         if (id != 0)
         {
             mm = Business.Do <INotice>().NoticeSingle(id);
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.Notice();
         }
         //公告标题
         mm.No_Ttl     = tbTtl.Text;
         mm.No_IsShow  = cbIsShow.Checked;
         mm.No_Context = tbContent.Text;
         //发布时间
         mm.No_StartTime = Convert.ToDateTime(tbStarTime.Text);
         //
         mm.No_Organ = tbOrg.Text;
         //确定操作
         if (id == 0)
         {
             EmpAccount acc = Extend.LoginState.Admin.CurrentUser;
             mm.Acc_Id   = acc.Acc_Id;
             mm.Acc_Name = acc.Acc_Name;
             Business.Do <INotice>().Add(mm);
         }
         else
         {
             Business.Do <INotice>().Save(mm);
         }
         Master.AlertCloseAndRefresh("操作成功!");
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Ejemplo n.º 29
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        protected void BindData(object sender, EventArgs e)
        {
            try
            {
                //总记录数
                int count = 0;

                EmpAccount acc = Extend.LoginState.Admin.CurrentUser;
                List <Song.Entities.AddressSort> eas = null;
                eas = Business.Do <IAddressList>().SortPager(acc.Acc_Id, this.tbSear.Text, Pager1.Size, Pager1.Index, out count);
                GridView1.DataSource   = eas;
                GridView1.DataKeyNames = new string[] { "Ads_Id" };
                GridView1.DataBind();

                Pager1.RecordAmount = count;
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        protected void BindData(object sender, EventArgs e)
        {
            try
            {
                //总记录数
                int count = 0;
                //状态
                string state = this.ddlState.SelectedItem.Value;
                //等级
                int level = Convert.ToInt16(ddlLevel.SelectedItem.Value);
                //查询字符
                string   sear      = tbSear.Text.Trim();
                DateTime startTime = DateTime.Now.AddYears(-100);
                //开始时间与结束时间
                if (tbStart.Text.Trim() != "")
                {
                    startTime = Convert.ToDateTime(tbStart.Text.Trim());
                }
                DateTime endTime = DateTime.Now.AddYears(100);
                if (this.tbEnd.Text.Trim() != "")
                {
                    endTime = Convert.ToDateTime(tbEnd.Text.Trim());
                }
                endTime = endTime.AddDays(1).AddSeconds(-1);
                //当前登录用户id
                EmpAccount           acc  = Extend.LoginState.Admin.CurrentUser;
                Song.Entities.Task[] task = null;
                task = Business.Do <ITask>().GetMyPager(acc.Acc_Id, false, startTime, endTime, state, level, sear, Pager1.Size, Pager1.Index, out count);

                GridView1.DataSource   = task;
                GridView1.DataKeyNames = new string[] { "Task_Id" };
                GridView1.DataBind();

                Pager1.RecordAmount = count;
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
        }