private bool Save(Framework.Task.Task task, ref string errmsg)
        {
            bool             result  = true;
            BaseDao          baseDao = new BaseDao();
            XtmDepart        entity  = task.Entity as XtmDepart;
            XtmDepartService service = new XtmDepartService();

            result = service.Validate("all", entity, ref errmsg);
            if (result == false)
            {
                return(false);
            }
            if (entity.Did != 0 && entity.ParentId != 0)
            {
                if (entity.Did == entity.ParentId)
                {
                    errmsg = "自己不能为自己的隶属机构";
                    return(false);
                }
            }

            if (entity.ParentId == 0)
            {
                entity.DepartLayer = 1;
            }
            else
            {
                XtmDepart parDep = new XtmDepart();
                parDep.Did         = entity.ParentId;
                parDep             = baseDao.Get(parDep);
                entity.DepartLayer = parDep.DepartLayer + 1;
            }
            if (entity.Did > 0)
            {
                baseDao.Update(entity);
            }
            else
            {
                XtmDepart temp = new XtmDepart();
                temp.DepartCode = entity.DepartCode;
                int count = baseDao.Count(temp);
                if (count > 0)
                {
                    errmsg = "该机构代码已经被使用";
                    return(false);
                }
                baseDao.Insert(entity);
            }

            if (result == true)
            {
                errmsg            = "保存成功";
                task.ParentRebind = true;
                task.IsClose      = true;
            }
            return(result);
        }
Exemple #2
0
        void WatchTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (running == true)
            {
                try
                {
                    WatchTimer.Enabled = false;
                    running            = false;
                    int startTime = int.Parse(System.Configuration.ConfigurationManager.AppSettings["startTime"].ToString());
                    if (DateTime.Now.Hour > startTime)
                    {
                        BaseDao   baseDao = new BaseDao();
                        XtmConfig config  = new XtmConfig();
                        config = baseDao.Get(config);
                        bool result = false;

                        if (DateTime.Now.Day >= int.Parse(config.Config1))
                        {
                            if (config.Config3 == "")
                            {
                                result = true;
                            }
                            else
                            {
                                DateTime st1 = DateTime.Parse(config.Config3);
                                DateTime st2 = DateTime.Parse("" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-01").AddMonths(-1);
                                if (st1.CompareTo(st2) == 0)
                                {
                                    result = false;
                                }
                                else
                                {
                                    result = true;
                                }
                            }
                        }
                        if (result == true)
                        {
                            DealJZ();
                        }
                    }
                }
                catch (Exception ex)
                {
                    string str = ex.Message;
                }
                finally
                {
                    WatchTimer.Enabled = true;
                    running            = true;
                }
            }
        }
Exemple #3
0
        protected void butSave_Click(object sender, EventArgs e)
        {
            string errmsg = "";

            if (this.xmm.Text == "")
            {
                this.laberr.Text = "新密码不能为空";
                return;
            }
            if (this.qrmm.Text == "")
            {
                this.laberr.Text = "确认密码不能为空";
                return;
            }
            if (this.xmm.Text.Trim() != this.qrmm.Text.Trim())
            {
                this.laberr.Text = "新密码和确认密码不一致";
                return;
            }
            if (this.ymm.Text.Trim() == "")
            {
                this.laberr.Text = "原密码不能为空";
                return;
            }
            BaseDao baseDao = new BaseDao();

            XtmUser user = new XtmUser();

            user.Did = int.Parse(user.SysUserId);
            user     = baseDao.Get(user);

            if (user != null)
            {
                string encryymm = Encry.Encode(this.ymm.Text.Trim());
                if (user.UserPwd != encryymm)
                {
                    this.laberr.Text = "原密码不正确";
                }
                else
                {
                    user.UserPwd = Encry.Encode(this.xmm.Text.Trim());
                    baseDao.Update(user);
                    Page.RegisterStartupScript("close", "<script language='javascript'>alert('修改成功');window.close();</script>");
                }
            }
            else
            {
                this.laberr.Text = "取用户资料出错";
            }
        }
Exemple #4
0
        private void ResetPwd(Framework.Task.Task task, ref string errmsg)
        {
            BaseDao baseDao = new BaseDao();
            XtmUser user    = new XtmUser();

            user.Did = int.Parse(task.CommandArgument);
            user     = baseDao.Get(user);
            if (user == null)
            {
                errmsg = "没有找到用户信息";
                return;
            }
            else
            {
                user.UserPwd = HuiYuIfo.Framework.Library.Encry.Encode(user.UserCode + "123");
                baseDao.Update(user);

                errmsg = "重置成功,密码为用户编码+123";
            }
        }
Exemple #5
0
 /// <summary>
 /// 创建实体后期动作
 /// </summary>
 public override void AfterCreateEntity()
 {
     base.AfterCreateEntity();
     if (!IsPostBack)
     {
         BaseDao   baseDao = new BaseDao();
         XtmConfig config  = new XtmConfig();
         config = baseDao.Get(config);
         int jzr = int.Parse(config.Config1);
         if (DateTime.Now.Day > jzr)
         {
             this.Entity.BegD = DateTime.Parse("" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-01");
         }
         else
         {
             DateTime dtt = DateTime.Now.AddMonths(-1);
             this.Entity.BegD = DateTime.Parse("" + dtt.Year + "-" + dtt.Month + "-01");
         }
         this.Entity.GetOpType = "CwConfrimList";
     }
 }
        private bool YwySave(Framework.Task.Task task, ref string errmsg)
        {
            bool result = true;

            this.BeginTran();
            try
            {
                YwData entity = task.Entity as YwData;
                if (entity.Bbr.Length <= 4)
                {
                    if (entity.Sfypz == "是")
                    {
                        YwDataService service = new YwDataService();
                        service.FirstCalculate(1, entity);
                        service.SeconeCalculate(entity);
                    }
                }
                else
                {
                    YwDataService service = new YwDataService();
                    service.FirstCalculate(1, entity);
                    service.SeconeCalculate(entity);
                }
                BaseDao baseDao = new BaseDao();

                int count = baseDao.Update(entity);
                if (count <= 0)
                {
                    errmsg            = "数据在页面显示后被其他人修改过,请重新打开编辑";
                    task.ParentRebind = true;
                    task.IsClose      = true;
                    return(false);
                }
                //文件压缩
                //删除压缩文件
                YwAttach att = new YwAttach();
                att.Type   = "2";
                att.Dataid = entity.Did;
                baseDao.DeleteUdf("YwAttachDeleteByType", att);
                //重新压缩附件
                att.Type = "1";
                IList <YwAttach> attList = baseDao.List(att);

                if (attList.Count > 0)
                {
                    string zipdic   = attList[0].Dic;
                    string zipFileN = Guid.NewGuid().ToString() + ".zip";
                    string path     = zipdic + zipFileN;
                    using (ZipFile zip = ZipFile.Create(@path))
                    {
                        zip.BeginUpdate();
                        foreach (YwAttach attTemp in attList)
                        {
                            string pathT = attTemp.Dic + attTemp.FileN;
                            zip.Add(@pathT, attTemp.FileN);
                        }
                        zip.CommitUpdate();
                    }
                    att.Type     = "2";
                    att.Dic      = zipdic;
                    att.FileN    = zipFileN;
                    att.RealName = zipFileN;
                    att.Dataid   = entity.Did;
                    baseDao.Insert(att);
                }
                if (result == true)
                {
                    YwData temp = new YwData();
                    temp.Did          = entity.Did;
                    temp              = baseDao.Get <YwData>(temp);
                    task.Entity       = temp;
                    errmsg            = "保存成功";
                    task.ParentRebind = true;
                }
                this.CommitTran();
            }
            catch (Exception ex)
            {
                this.RollbackTran();
                errmsg = ex.Message;
            }
            return(result);
        }
Exemple #7
0
 public virtual T Get(object pkid)
 {
     return(_dao.Get(pkid));
 }