Exemple #1
0
        private bool Save(Framework.Task.Task task, ref string errmsg)
        {
            bool      result  = true;
            BaseDao   baseDao = new BaseDao();
            XtmConfig entity  = task.Entity as XtmConfig;

            if (entity.Config1 == "")
            {
                errmsg = "结账日不能为空";
                return(false);
            }
            try
            {
                int temp = int.Parse(entity.Config1);
                if (temp < 0 || temp > 28)
                {
                    errmsg = "结账日只能在1到28号之间";
                    return(false);
                }
            }
            catch
            {
                errmsg = "结账日不正确,应该是整数";
                return(false);
            }
            baseDao.Update(entity);
            errmsg = "保存成功";
            return(result);
        }
        private void DataExportLastZQ(Framework.Task.Task task, ref string errmsg)
        {
            YwData        entity  = (YwData)task.Entity;
            YwDataService service = new YwDataService();
            YwData        param   = new YwData();

            param.EndD = service.GetBegDate();
            param.BegD = param.EndD.AddMonths(-1);
            IWorkbook book = null;

            if (entity.SysUserType == "ywy")
            {
                param.Ywy = entity.Ywy;
                book      = service.QueryExportData("ywy", param, ref errmsg);
            }
            else
            {
                param.GetOpType = "departPri";
                book            = service.QueryExportData("all", param, ref errmsg);
            }


            if (task.paralist == null)
            {
                task.paralist = new System.Collections.ArrayList();
            }
            task.paralist.Add(book);
        }
Exemple #3
0
        private bool Delete(Framework.Task.Task task, ref string errmsg)
        {
            XtmUser delModel = new XtmUser();

            delModel.SysKey = task.CommandArgument;
            BaseDao baseDao = new BaseDao();

            this.BeginTran();
            try
            {
                XtmMenuPri delMenuPri = new XtmMenuPri();
                delMenuPri.UserId = int.Parse(task.CommandArgument);
                baseDao.Delete(delMenuPri);

                XtmUserPri delUserPri = new XtmUserPri();
                delUserPri.UserId = int.Parse(task.CommandArgument);
                baseDao.DeleteUdf("XtmUserPriDeleteAll", delUserPri);

                baseDao.Delete(delModel);
                this.CommitTran();
            }
            catch (Exception ex)
            {
                this.RollbackTran();
                errmsg = ex.Message;
                return(false);
            }
            if (errmsg != "")
            {
                return(false);
            }
            errmsg      = "删除成功";
            task.Rebind = true;
            return(true);
        }
        public override bool Execute(Framework.Task.Task task, ref string errmsg)
        {
            bool result = true;

            switch (task.Command)
            {
            case "showAtt":
                task.PagePath  = "../Yw/CbShowAtt.aspx";
                task.PageParam = ((YwData)task.Entity).Did.ToString();
                break;

            case "ywyShow":
                task.PagePath  = "YwyDataShow.aspx";
                task.PageParam = task.CommandArgument;
                break;

            case "queryExport":
                DataExportLastZQ(task, ref errmsg);
                break;

            case "ywyQueryExport":
                //业务员导出最后结帐数据
                YwyExportLastZQ(task, ref errmsg);
                break;

            case "historyExport":
                HistoryExport(task, ref errmsg);
                break;
            }
            return(result);
        }
        private void HistoryExport(Framework.Task.Task task, ref string errmsg)
        {
            YwData        entity  = (YwData)task.Entity;
            YwDataService service = new YwDataService();
            YwData        param   = new YwData();

            param.BegD   = DateTime.Parse("" + entity.Year + "-" + entity.Month + "-01");
            param.EndD   = param.BegD.AddMonths(1);
            param.Depart = entity.Depart;
            param.Ywy    = entity.Ywy;
            IWorkbook book = null;

            if (entity.SysUserType == "ywy")
            {
                param.Ywy = entity.SysUserCode;
                book      = service.QueryExportData("ywy", param, ref errmsg);
            }
            else
            {
                param.GetOpType = "departPri";
                book            = service.QueryExportData("all", param, ref errmsg);
            }


            if (task.paralist == null)
            {
                task.paralist = new System.Collections.ArrayList();
            }
            task.paralist.Add(book);
        }
        private bool CwSave(Framework.Task.Task task, ref string errmsg)
        {
            bool result = true;

            try
            {
                YwData        entity  = task.Entity as YwData;
                BaseDao       baseDao = new BaseDao();
                YwDataService service = new YwDataService();
                DateTime      begD    = service.GetBegDate();
                if (entity.CreateDate < begD)
                {
                    throw new Exception("数据已经超过结账日,不允许修改");
                }
                service.FirstCalculate(1, entity);
                service.SeconeCalculate(entity);
                entity.CwConfirm = DateTime.Now;
                baseDao.Update(entity);
                if (result == true)
                {
                    errmsg            = "保存成功";
                    task.ParentRebind = true;
                    task.IsClose      = true;
                }
            }
            catch (Exception ex)
            {
                errmsg = "保存失败:" + ex.Message;
                return(false);
            }
            return(result);
        }
        private bool ClearAllAtt(Framework.Task.Task task, ref string errmsg)
        {
            this.BeginTran();
            try
            {
                BaseDao baseDao = new BaseDao();
                YwData  entity  = task.Entity as YwData;
                entity.AttachmentCount = 0;
                Hashtable ht = new Hashtable();
                ht.Add("Did", entity.Did);
                baseDao.UpdateUdf("YwDataAttClear", ht);

                YwAttach att = new YwAttach();
                att.Dataid = entity.Did;
                baseDao.Delete(att);
                this.CommitTran();
                errmsg = "清空成功";
            }
            catch (Exception ex)
            {
                this.RollbackTran();
                errmsg = ex.Message;
                return(false);
            }
            return(true);
        }
Exemple #8
0
        //承保审核退回
        private bool CbUnComfirm(Framework.Task.Task task, ref string errmsg)
        {
            bool result = true;

            try
            {
                YwData        entity  = task.Entity as YwData;
                BaseDao       baseDao = new BaseDao();
                YwDataService service = new YwDataService();
                entity.Status = "2";
                entity.Cbback = "Y";
                DateTime begD = service.GetBegDate();
                if (entity.CreateDate < begD)
                {
                    throw new Exception("数据已经超过结账日,不允许修改");
                }
                baseDao.Update(entity);
                if (result == true)
                {
                    errmsg            = "操作成功";
                    task.ParentRebind = true;
                    task.IsClose      = true;
                }
            }
            catch (Exception ex)
            {
                errmsg = ex.Message;
                return(false);
            }
            return(result);
        }
        public override bool Execute(Framework.Task.Task task, ref string errmsg)
        {
            switch (task.Command)
            {
            case "export":
                Export(task, ref errmsg);
                break;

            case "ucreate":
                task.PagePath = "DepartEdit.aspx";
                task.Width    = 700;
                task.Height   = 300;
                break;

            case "uedit":
                task.PagePath  = "DepartEdit.aspx";
                task.Width     = 700;
                task.Height    = 300;
                task.PageParam = task.CommandArgument;
                break;

            case "udelete":
                Delete(task, ref errmsg);
                break;

            case "save":
                Save(task, ref errmsg);
                break;
            }
            return(true);
        }
Exemple #10
0
        private bool DealImport(Framework.Task.Task task, ref string errmsg)
        {
            bool result = true;

            this.BeginTran();
            try
            {
                using (FileStream fs = File.OpenRead(task.paralist[0].ToString()))   //打开myxls.xls文件
                {
                    IWorkbook    book        = WorkbookFactory.Create(fs);
                    YwCyhService specService = new YwCyhService();
                    result = specService.DealWorkbook(book, ref errmsg);
                }
                if (result == false)
                {
                    this.RollbackTran();
                    return(false);
                }
                this.CommitTran();
                errmsg            = "上传成功";
                task.ParentRebind = true;
                task.IsClose      = true;
            }
            catch (Exception ex)
            {
                errmsg = ex.Message;
                this.RollbackTran();
                return(false);
            }
            return(true);
        }
Exemple #11
0
        //承保编辑保存
        private bool CbSave(Framework.Task.Task task, ref string errmsg)
        {
            bool result = true;

            try
            {
                YwData        entity  = task.Entity as YwData;
                YwDataService service = new YwDataService();
                if (service.Validate("cbEdit", entity, ref errmsg) == false)
                {
                    return(false);
                }
                DateTime begD = service.GetBegDate();
                if (entity.CreateDate < begD)
                {
                    throw new Exception("数据已经超过结账日,不允许修改");
                }
                BaseDao baseDao = new BaseDao();
                if (entity.Sybf <= 0)
                {
                    entity.Xz = "交强险";
                }
                else
                {
                    entity.Xz = "商业险";
                }
                if (entity.Xz == "商业险")
                {
                    entity.Status = "2";
                }
                else
                {
                    entity.Status = "4";
                    service.FirstCalculate(1, entity);
                    service.SeconeCalculate(entity);
                }
                entity.CbSubmit = DateTime.Now;
                int count = baseDao.Update(entity);
                if (count <= 0)
                {
                    errmsg            = "数据在页面显示后被其他人修改过,请重新打开编辑";
                    task.ParentRebind = true;
                    task.IsClose      = true;
                    return(false);
                }
                if (result == true)
                {
                    errmsg            = "保存成功";
                    task.ParentRebind = true;
                    task.IsClose      = true;
                }
            }
            catch (Exception ex)
            {
                errmsg = ex.Message;
                return(false);
            }
            return(result);
        }
Exemple #12
0
        private void DealJZ()
        {
            string           errmsg     = "";
            YwDataController controller = new YwDataController();

            Framework.Task.Task task = new Framework.Task.Task();
            task.Command = "jz";
            controller.Execute(task, ref errmsg);
        }
        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 #14
0
        public override bool Execute(Framework.Task.Task task, ref string errmsg)
        {
            switch (task.Command)
            {
            case "resetPwd":
                ResetPwd(task, ref errmsg);
                break;

            case "export":
                Export(task, ref errmsg);
                break;

            case "upri":
                task.Width     = 500;
                task.Height    = 600;
                task.PagePath  = "MenuPriEdit.aspx";
                task.PageParam = task.CommandArgument;
                break;

            case "uywpri":
                task.Width     = 700;
                task.Height    = 600;
                task.PagePath  = "UserPriEdit.aspx";
                task.PageParam = task.CommandArgument;
                break;

            case "ucreate":
                task.PagePath = "UserEdit.aspx";
                task.Width    = 700;
                task.Height   = 300;
                break;

            case "uedit":
                task.PagePath  = "UserEdit.aspx";
                task.Width     = 700;
                task.Height    = 300;
                task.PageParam = task.CommandArgument;
                break;

            case "ushow":
                task.PagePath  = "UserShow.aspx";
                task.Width     = 700;
                task.Height    = 300;
                task.PageParam = task.CommandArgument;
                break;

            case "udelete":
                Delete(task, ref errmsg);
                break;

            case "save":
                Save(task, ref errmsg);
                break;
            }
            return(true);
        }
Exemple #15
0
 public override bool Execute(Framework.Task.Task task, ref string errmsg)
 {
     switch (task.Command)
     {
     case "save":
         Save(task, ref errmsg);
         break;
     }
     return(true);
 }
        private void Export(Framework.Task.Task task, ref string errmsg)
        {
            XtmDepartService service1 = new XtmDepartService();
            IWorkbook        book     = service1.ExportData(ref errmsg);

            if (task.paralist == null)
            {
                task.paralist = new System.Collections.ArrayList();
            }
            task.paralist.Add(book);
        }
Exemple #17
0
        public override bool Execute(Framework.Task.Task task, ref string errmsg)
        {
            switch (task.Command)
            {
            case "uedit":
                task.PagePath = "CwAnalyEdit.aspx";

                task.PageParam = task.CommandArgument;
                break;

            case "save":
                Save(task, ref errmsg);
                break;
            }
            return(true);
        }
        private void YwyExportLastZQ(Framework.Task.Task task, ref string errmsg)
        {
            YwData        entity  = (YwData)task.Entity;
            YwDataService service = new YwDataService();
            YwData        param   = new YwData();

            param.EndD = service.GetBegDate();
            param.BegD = param.EndD.AddMonths(-1);
            param.Ywy  = entity.Ywy;

            IWorkbook book = service.QueryExportData("ywy", param, ref errmsg);

            if (task.paralist == null)
            {
                task.paralist = new System.Collections.ArrayList();
            }
            task.paralist.Add(book);
        }
        public override bool Execute(Framework.Task.Task task, ref string errmsg)
        {
            switch (task.Command)
            {
                #region 业务员编辑页面
            case "ywyEdit":    //业务员编辑(第二次)
                task.PagePath  = "YwyDataEdit.aspx";
                task.PageParam = task.CommandArgument;
                break;

            case "clearAllAtt":    //业务员清除附件
                ClearAllAtt(task, ref errmsg);
                break;

            case "ywySubmit":
                YwySubmit(task, ref errmsg);
                break;

            case "ywySave":    //业务员保存(第二步)
                YwySave(task, ref errmsg);
                break;

                #endregion
            case "showAtt":
                task.PagePath  = "YwyShowAtt.aspx";
                task.PageParam = ((YwData)task.Entity).Did.ToString();
                break;

                //#region 结账数据导出
                //case "ywyQueryExport":
                //    ///业务员结账数据导出
                //    YwDataService service3 = new YwDataService();
                //    IWorkbook book3 = service3.YwyExportData();
                //    if (task.paralist == null)
                //    {
                //        task.paralist = new System.Collections.ArrayList();
                //    }
                //    task.paralist.Add(book3);
                //    break;

                //#endregion
            }
            return(true);
        }
        private bool Delete(Framework.Task.Task task, ref string errmsg)
        {
            XtmDepart delModel = new XtmDepart();

            delModel.SysKey = task.CommandArgument;
            BaseDao   baseDao = new BaseDao();
            XtmDepart temp    = new XtmDepart();

            temp.ParentId = delModel.Did;
            int count = baseDao.Count(temp);

            if (count > 0)
            {
                errmsg = "该部门底下挂有子部门,不允许删除";
                return(false);
            }
            XtmUser userM = new XtmUser();

            userM.DepartId = delModel.Did;
            count          = baseDao.Count(userM);
            if (count > 0)
            {
                errmsg = "该部门底下挂有人员,不允许删除";
                return(false);
            }
            try
            {
                baseDao.Delete(delModel);
            }
            catch (Exception ex)
            {
                errmsg = ex.Message;
                return(false);
            }
            if (errmsg != "")
            {
                return(false);
            }
            errmsg      = "删除成功";
            task.Rebind = true;
            return(true);
        }
Exemple #21
0
 public override bool Execute(Framework.Task.Task task, ref string errmsg)
 {
     switch (task.Command)
     {
     case "jz":    //结帐
         YwDataService service = new YwDataService();
         this.BeginTran();
         try
         {
             service.DealJZ();
             this.CommitTran();
         }
         catch (Exception ex)
         {
             this.RollbackTran();
         }
         break;
     }
     return(true);
 }
Exemple #22
0
        //承保导出本月所有数据
        private void ExportAll(Framework.Task.Task task, ref string errmsg)
        {
            YwData        entity  = task.Entity as YwData;
            YwDataService service = new YwDataService();

            YwData   param  = new YwData();
            DateTime dtTemp = DateTime.Now.AddMonths(1);

            param.BegD = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            param.EndD = new DateTime(dtTemp.Year, dtTemp.Month, 1);

            param.GetOpType = "CbExportAll";
            IWorkbook book = service.ExportData(param, ref errmsg);

            if (task.paralist == null)
            {
                task.paralist = new System.Collections.ArrayList();
            }
            task.paralist.Add(book);
        }
Exemple #23
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 #24
0
        //承保新增保存
        private bool CbCreateSave(Framework.Task.Task task, ref string errmsg)
        {
            bool result = true;

            try
            {
                BaseDao       baseDao = new BaseDao();
                YwData        entity  = task.Entity as YwData;
                YwDataService service = new YwDataService();
                result = service.Validate("cbCreate", entity, ref errmsg);
                if (result == false)
                {
                    return(false);
                }
                if (entity.Sybf <= 0)
                {
                    entity.Xz = "交强险";
                }
                else
                {
                    entity.Xz = "商业险";
                }
                entity.Status = "4";

                service.FirstCalculate(1, entity);
                service.SeconeCalculate(entity);
                entity.CbSubmit = DateTime.Now;
                baseDao.Insert(entity);
                errmsg = "新增成功";

                task.ParentRebind = true;
                task.IsClose      = true;
            }
            catch (Exception ex)
            {
                errmsg = ex.Message;
                return(false);
            }
            return(result);
        }
Exemple #25
0
        private bool Save(Framework.Task.Task task, ref string errmsg)
        {
            bool result = true;

            YwTxjsService service = new YwTxjsService();
            YwTxjs        entity  = task.Entity as YwTxjs;

            if (service.Validate("all", entity, ref errmsg) == false)
            {
                return(false);
            }
            BaseDao baseDao = new BaseDao();

            if (entity.Did > 0)
            {
                baseDao.Update(entity);
            }
            else
            {
                YwTxjs temp = new YwTxjs();
                temp.Txm = entity.Txm;
                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 #26
0
        //承保数据导入处理
        private bool DealImport(Framework.Task.Task task, ref string errmsg)
        {
            bool result = true;

            this.BeginTran();
            try
            {
                string       errType = "";
                XSSFWorkbook errBook = new XSSFWorkbook();
                using (FileStream fs = File.OpenRead(task.paralist[0].ToString()))
                {
                    IWorkbook     book    = WorkbookFactory.Create(fs);
                    YwDataService service = new YwDataService();
                    result = service.DealCbImport(book, errBook, ref errType, ref errmsg);
                }
                task.paralist = new System.Collections.ArrayList();
                if (result == false)
                {
                    if (errType == "content")
                    {
                        task.paralist.Add(errBook);
                    }
                    this.RollbackTran();
                    return(false);
                }
                this.CommitTran();
                errmsg            = "上传成功";
                task.ParentRebind = true;
                task.IsClose      = true;
            }
            catch (Exception ex)
            {
                errmsg = ex.Message;
                this.RollbackTran();
                return(false);
            }
            return(true);
        }
Exemple #27
0
        private bool Save(Framework.Task.Task task, ref string errmsg)
        {
            bool           result  = true;
            BaseDao        baseDao = new BaseDao();
            XtmUser        entity  = task.Entity as XtmUser;
            XtmUserService service = new XtmUserService();

            result = service.Validate("all", entity, ref errmsg);
            if (result == false)
            {
                return(false);
            }
            if (entity.Did > 0)
            {
                baseDao.Update(entity);
            }
            else
            {
                XtmUser temp = new XtmUser();
                temp.UserCode = entity.UserCode;
                int count = baseDao.Count(temp);
                if (count > 0)
                {
                    errmsg = "该人员代码已经被使用";
                    return(false);
                }
                entity.UserPwd = HuiYuIfo.Framework.Library.Encry.Encode(entity.UserCode + "123");
                baseDao.Insert(entity);
            }

            if (result == true)
            {
                errmsg            = "保存成功";
                task.ParentRebind = true;
                task.IsClose      = true;
            }
            return(result);
        }
Exemple #28
0
        private bool Delete(Framework.Task.Task task, ref string errmsg)
        {
            Yw_txm delModel = new Yw_txm();

            delModel.SysKey = task.CommandArgument;
            BaseDao baseDao = new BaseDao();

            try
            {
                baseDao.Delete(delModel);
            }
            catch (Exception ex)
            {
                errmsg = ex.Message;
                return(false);
            }
            if (errmsg != "")
            {
                return(false);
            }
            errmsg      = "删除成功";
            task.Rebind = true;
            return(true);
        }
Exemple #29
0
        private bool Save(Framework.Task.Task task, ref string errmsg)
        {
            bool result = true;

            Yw_txmService service = new Yw_txmService();
            Yw_txm        entity  = task.Entity as Yw_txm;

            if (service.Validate("all", entity, ref errmsg) == false)
            {
                return(false);
            }
            BaseDao baseDao = new BaseDao();

            if (entity.Did > 0)
            {
                baseDao.Update(entity);
            }
            else
            {
                bool res = service.CheckExist(entity);
                if (res == true)
                {
                    errmsg = "该推修码数据已经被定义";
                    return(false);
                }
                baseDao.Insert(entity);
            }

            if (result == true)
            {
                errmsg            = "保存成功";
                task.ParentRebind = true;
                task.IsClose      = true;
            }
            return(result);
        }
Exemple #30
0
        private bool Save(Framework.Task.Task task, ref string errmsg)
        {
            bool    result  = true;
            BaseDao baseDao = new BaseDao();
            YwAnlay entity  = task.Entity as YwAnlay;

            if (entity.Bz != "Y")
            {
                errmsg = "该条数据已过帐期,不能修改";
                return(false);
            }

            entity.Srhj = entity.Cxzdxje + entity.Cxfdjx + entity.Sryfgz;
            entity.Zchj = entity.Sxf + entity.Fybx + entity.Zcyfgz + entity.Xcp;
            entity.Byjy = entity.Syjy + entity.Srhj - entity.Zchj;
            baseDao.Update(entity);
            if (result == true)
            {
                errmsg            = "保存成功";
                task.ParentRebind = true;
                task.IsClose      = true;
            }
            return(result);
        }