Ejemplo n.º 1
0
 public string DeleteZfUnitiData(string userid, string id)
 {
     IDbTransaction tran = Utility.Database.BeginDbTransaction();//开始事务并返回一个事务对象
     SkyLandDeveloper developer = new SkyLandDeveloper("{}", userid, tran);//获取业务流相关参数
     try
     {
         Para_ZfUniti data = new Para_ZfUniti();
         data.Condition.Add("id = " + id);//设置查询条件,条件为当前用户ID
         Utility.Database.Delete(data, tran);
         developer.Commit();//提交事务
         return Utility.JsonMsg(true, "删除成功!");
     }
     catch (Exception ex)
     {
         developer.RollBack();//回滚事务
         ComBase.Logger(ex);//写日专到本地文件
         return Utility.JsonMsg(false, "删除失败:" + ex.Message);
     }
 }
Ejemplo n.º 2
0
        public string Save(string JsonData, string userid)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper("{}",userid,tran);
            int WorkingDayID = 0;
            try
            {
                //操作主表
                B_OA_WorkingDay dataModel = JsonConvert.DeserializeObject<B_OA_WorkingDay>(JsonData);
                //每修改一次增加一个班次、不做判断
                dataModel.Condition.Add("WorkingDayID = " + dataModel.WorkingDayID);

                if (Utility.Database.Insert<B_OA_WorkingDay>(dataModel, tran) > 0)
                {
                    StringBuilder strSql = new StringBuilder();
                    strSql = new StringBuilder();
                    strSql.Append(@"SELECT @@IDENTITY FROM B_OA_WorkingDay");
                    DataSet dataSet = Utility.Database.ExcuteDataSet(strSql.ToString(), tran);
                    if (dataSet.Tables.Count > 0)
                    {
                        if (dataSet.Tables[0].Rows.Count > 0)
                            WorkingDayID = Convert.ToInt32(dataSet.Tables[0].Rows[0][0]);
                    }
                }

                B_OA_WorkingTimes time = new B_OA_WorkingTimes();
                time.Condition.Add("WorkingDayID = " + dataModel.WorkingDayID);
                time.WorkingDayID = WorkingDayID;
                time.StartTime = "1900-1-1 " + dataModel.StartTime + ":00";
                time.EndTime = "1900-1-1 " + dataModel.EndTime + ":00";
                Utility.Database.Insert<B_OA_WorkingTimes>(time, tran);
                developer.Commit();
                return Utility.JsonResult(true, "保存成功");
            }
            catch (Exception e)
            {
                developer.RollBack();
                return Utility.JsonResult(false, "保存数据失败!异常信息: " + e.Message);
            }
        }
Ejemplo n.º 3
0
        public string DeleteData(string userid, string id)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();//开始事务并返回一个事务对象
            SkyLandDeveloper developer = new SkyLandDeveloper("{}", userid, tran);//获取业务流相关参数
            try
            {

                Para_UsedPhrase usedPhrase = new Para_UsedPhrase();
                usedPhrase.Condition.Add("id = " + id);//设置查询条件,条件为当前用户ID
                Utility.Database.Delete(usedPhrase, tran);
                developer.Commit();//提交事务
                //return JsonConvert.SerializeObject( retContent);
                return Utility.JsonMsg(true, "删除成功!");
            }
            catch (Exception ex)
            {
                developer.RollBack();//回滚事务
                ComBase.Logger(ex);//写日专到本地文件
                return Utility.JsonMsg(false, "删除失败:" + ex.Message);
                //return Utility.JsonMsg(false, "删除失败:" + ex.Message);
            }
        }
 public void SetCaseName(GetDataModel data, SkyLandDeveloper developer)
 {
     try
     {
         string unitName = data.baseInfor_Notice.NewsTitle;
         string titleType = "文档发布";
         developer.caseName = unitName + "-" + titleType;
     }
     catch (Exception ex)
     {
         ComBase.Logger(ex);
     }
 }
Ejemplo n.º 5
0
 public string Send(string BizParams, string userid, string content)
 {
     IDbTransaction tran = Utility.Database.BeginDbTransaction();
     SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
     try
     {
         SaveDataModel data = JsonConvert.DeserializeObject<SaveDataModel>(content);
         string caseid = data.baseInfo.caseId;
         if (caseid == null || caseid.Equals(""))
         {
             caseid = developer.Create();
         }
         if (developer.wfcase.actid == "A001")
         {
             data.baseInfo.traveler = userid;
             data.baseInfo.travelStatus = "1";
             developer.caseName = ComClass.GetUserInfo(userid).CnName + "-出差申请";
         }
         else
         {
             data.baseInfo.travelStatus = "2";
         }
         SaveData(data, tran, caseid);
         developer.Send();
         developer.Commit();
         return Utility.JsonResult(true, "发送成功!");
     }
     catch (Exception ex)
     {
         developer.RollBack();
         ComBase.Logger(ex);
         throw (new Exception("业务发送失败!", ex));
     }
 }
Ejemplo n.º 6
0
        public string Send(string BizParams, string userid, string content)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
            try
            {
                SaveDataModel data = JsonConvert.DeserializeObject<SaveDataModel>(content);
                //                StringBuilder strSql = new StringBuilder();
                //                strSql.Append(@"SELECT
                //	workflowcaseid, sqr, sqrid, sqsj, ycks, ycksid, rs, ycsj, sycl, ccdd, ycsy, B.CnName AS pcr, (CASE pcsj WHEN '1900-1-1 00:00:00' THEN '' ELSE pcsj END) AS pcsj , fhsj, ccr, Stroke, Distance, Status, CONVERT(VARCHAR(16),CreatTime,120) AS CreatTime,
                //	(CASE Status WHEN 0 THEN '待派车' ELSE '已派车' END) AS StatusText,(CONVERT(VARCHAR(16),ycsj,120) +'---' +CONVERT(VARCHAR(16),fhsj,120)) AS useTime, sycl as cph,C.CnName AS driverName
                //FROM B_OA_Car A
                //    LEFT JOIN FX_UserInfo B ON A.pcr = B.UserID
                //    LEFT JOIN FX_UserInfo C ON A.ccr = C.UserID WHERE workflowcaseid <> '" + data.baseInfo.workflowcaseid + "' AND  sycl = '" + data.baseInfo.cph + "' AND(('" + data.baseInfo.ycsj + "' Between ycsj and fhsj)OR ('" + data.baseInfo.fhsj + "' Between ycsj and fhsj))");
                //                DataTable table = Utility.Database.ExcuteDataSet(strSql.ToString()).Tables[0];
                //                if (table.Rows.Count > 0)
                //                    return Utility.JsonMsg(false, "车牌号:" + table.Rows[0]["cph"].ToString() + "\n时间:" + table.Rows[0]["ycsj"].ToString() + " 至 " + table.Rows[0]["fhsj"].ToString() + "\n申请人:" + table.Rows[0]["sqr"].ToString());

                //                strSql = new StringBuilder();
                //                strSql.Append(@"SELECT
                //	workflowcaseid, sqr, sqrid, sqsj, ycks, ycksid, rs, ycsj, sycl, ccdd, ycsy, B.CnName AS pcr, (CASE pcsj WHEN '1900-1-1 00:00:00' THEN '' ELSE pcsj END) AS pcsj , fhsj, ccr, Stroke, Distance, Status, CONVERT(VARCHAR(16),CreatTime,120) AS CreatTime,
                //	(CASE Status WHEN 0 THEN '待派车' ELSE '已派车' END) AS StatusText,(CONVERT(VARCHAR(16),ycsj,120) +'---' +CONVERT(VARCHAR(16),fhsj,120)) AS useTime, sycl as cph,C.CnName AS driverName
                //FROM B_OA_Car A
                //    LEFT JOIN FX_UserInfo B ON A.pcr = B.UserID
                //    LEFT JOIN FX_UserInfo C ON A.ccr = C.UserID WHERE workflowcaseid <> '" + data.baseInfo.workflowcaseid + "' AND  ccr = '" + data.baseInfo.cph + "' AND(('" + data.baseInfo.ycsj + "' Between ycsj and fhsj)OR ('" + data.baseInfo.fhsj + "' Between ycsj and fhsj))");
                //                table = Utility.Database.ExcuteDataSet(strSql.ToString()).Tables[0];
                //                if (table.Rows.Count > 0)
                //                    return Utility.JsonMsg(false, "司机:" + table.Rows[0]["driverName"].ToString() + "\n时间:" + table.Rows[0]["ycsj"].ToString() + " 至 " + table.Rows[0]["fhsj"].ToString() + "\n申请人:" + table.Rows[0]["sqr"].ToString());

                string caseid = developer.caseid;
                if (String.IsNullOrEmpty(caseid))
                {
                    string unitName = data.baseInfo.useMan;
                    string titleType = "用车申请";
                    developer.caseName = unitName + "-" + titleType;
                    caseid = developer.Create();
                }
                SaveData(data, tran, caseid);
                developer.Send();
                developer.Commit();
                return Utility.JsonMsg(true, "发送成功!");
            }
            catch (Exception ex)
            {
                developer.RollBack();
                ComBase.Logger(ex);
                throw (new Exception("业务发送失败!", ex));
            }
        }
Ejemplo n.º 7
0
        public string SaveData(string userid, string nr, string lx)
        {
            if (nr == null || nr.ToString() == "") return Utility.JsonResult(true, "数据不能空");
            //UTF8Encoding utf = new UTF8Encoding();
            //lx = utf.GetString(Encoding.Unicode.GetBytes(lx)).Trim();
            //byte[] utf8Bytes = Encoding.UTF8.GetBytes(lx);
            //lx = Encoding.GetEncoding("UTF-8").GetString(utf8Bytes);

            nr = nr.Trim();
            IDbTransaction tran = Utility.Database.BeginDbTransaction();//开始事务并返回一个事务对象
            SkyLandDeveloper developer = new SkyLandDeveloper("{}", userid, tran);//获取业务流相关参数
            try
            {
                Para_UsedPhrase usedPhrase = new Para_UsedPhrase();
                usedPhrase.nr = nr;
                usedPhrase.cjrid = userid;
                usedPhrase.lx = lx;
                usedPhrase.Condition.Add("cjrid=" + userid);
                usedPhrase.Condition.Add("lx=" + lx);
                usedPhrase.Condition.Add("nr=" + nr);
                List<Para_UsedPhrase> list = Utility.Database.QueryList(usedPhrase);
                DataSet ds = Utility.Database.ExcuteDataSet("select isnull(MAX(sypl),0) as sypl from Para_UsedPhrase where cjrid='" + userid + "' and lx='" + lx + "'");
                usedPhrase.sypl = (int)ds.Tables[0].Rows[0]["sypl"] + 1;
                if (list == null || list.Count < 1)
                {
                    usedPhrase.cjsj = DateTime.Now;
                    Utility.Database.Insert(usedPhrase, tran);
                }
                else
                {
                    Utility.Database.Update(usedPhrase, tran);
                }

                developer.Commit();//提交事务
                //return Utility.JsonResult(true, "保存成功!", retContent);
                return Utility.JsonResult(true, "保存成功!");
            }
            catch (Exception ex)
            {
                developer.RollBack();//回滚事务
                ComBase.Logger(ex);//写日专到本地文件
                return Utility.JsonResult(false, "保存失败:" + ex.Message);
                //return Utility.JsonResult(false, "删除失败:" + ex.Message);
            }
        }
Ejemplo n.º 8
0
 public string Send(string BizParams, string userid, string content)
 {
     IDbTransaction tran = Utility.Database.BeginDbTransaction();
     SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
     try
     {
         GetDataModel data = JsonConvert.DeserializeObject<GetDataModel>(content);// new SaveDataModel();
         string caseid = developer.caseid;
         if (String.IsNullOrEmpty(caseid))
         {
             string unitName = data.delayApplyBaseInfor.title;
             string titleType = "督办延期申请";
             developer.caseName = unitName + "-" + titleType;
             caseid = developer.Create();
         }
         StringBuilder strSql = new StringBuilder();
         SaveData(data, tran, caseid);
         //SetCaseName(data, developer);
         developer.Send();
         //修改延期时间
         if (developer.wfcase.actid == "A003")
         {
             SetLimiteData(caseid, tran);
         }
         developer.Commit();
         return Utility.JsonMsg(true, "发送成功!");
     }
     catch (Exception ex)
     {
         developer.RollBack();
         ComBase.Logger(ex);
         throw (new Exception("业务发送失败!", ex));
     }
 }
Ejemplo n.º 9
0
        public string Send(string BizParams, string userid, string content)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
            try
            {
                GetDataModel data = JsonConvert.DeserializeObject<GetDataModel>(content);
                string caseid = developer.caseid;

                if (String.IsNullOrEmpty(caseid))
                {
                    string unitName = data.sendDocBaseInfo.title;
                    string titleType = "环科所发文";
                    developer.caseName = unitName + "-" + titleType;
                    caseid = developer.Create();

                    //作者名字
                    data.sendDocBaseInfo.createManName = ComClass.GetUserInfo(userid).CnName;
                }

                if (developer.wfcase.actid == "A001")
                {

                    //业务关联表
                    if (data.sendRelation.relationCaseId != "")
                    {
                        B_OA_SendDoc_R sendR = new B_OA_SendDoc_R();
                        sendR.actId = data.sendRelation.actId;
                        sendR.caseId = caseid;
                        sendR.wId = data.sendRelation.wId;
                        sendR.filePath = data.sendRelation.filePath;
                        sendR.triggerActId = data.sendRelation.triggerActId;
                        sendR.relationCaseId = data.sendRelation.relationCaseId;
                        Utility.Database.Insert<B_OA_SendDoc_R>(sendR, tran);
                    }
                }

                SaveData(data, tran, caseid);
                SetCaseName(data, developer);
                developer.Send();
                developer.Commit();
                return Utility.JsonMsg(true, "发送成功!");
            }
            catch (Exception ex)
            {
                developer.RollBack();
                ComBase.Logger(ex);
                throw (new Exception("业务发送失败!", ex));
            }
        }
Ejemplo n.º 10
0
 public void SetCaseName(SaveDataModel data, SkyLandDeveloper developer)
 {
     try
     {
         string unitName = data.sendDocBaseInfo.wjbt;
         string titleType = "发文";
         developer.caseName = unitName + "-" + titleType;
     }
     catch (Exception ex)
     {
         ComBase.Logger(ex);
     }
 }
Ejemplo n.º 11
0
        public string Send(string BizParams, string userid, string content)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
            try
            {
                GetDataModel data = JsonConvert.DeserializeObject<GetDataModel>(content);// new SaveDataModel();

                string caseid = developer.caseid;
                if (String.IsNullOrEmpty(caseid))
                {
                    string unitName = data.supervisionBaseInfo.title;
                    string titleType = "交办事项督办";
                    developer.caseName = unitName + "-" + titleType;
                    caseid = developer.Create();
                }

                if (developer.wfcase.actid == "A001")
                {
                    data.supervisionBaseInfo.code = CreateSendNo("DB", tran);
                    //当此文未草稿的时候并未生成caseid,而存的是guid,此步骤是将正文路径的caseid字段修改成caseid
                    ChangeGuidToCaseId(developer.wfcase.guid, caseid, tran);

                    //保存督办申请单
                    if (!string.IsNullOrEmpty(data.supervisionBaseInfo.issuerManId))
                    {
                        data.supervisionBill.issuerManId = data.supervisionBaseInfo.issuerManId;
                        data.supervisionBill.issuerManName = data.supervisionBaseInfo.issuerManName.Replace(';', ' ');
                    }

                    SaveSupervisionNoticeBill(data.supervisionBill, caseid, tran);
                }
                SaveData(data, tran, caseid);
                //SetCaseName(data, developer);
                developer.Send();
                developer.Commit();
                return Utility.JsonMsg(true, "发送成功!");
            }
            catch (Exception ex)
            {
                developer.RollBack();
                ComBase.Logger(ex);
                throw (new Exception("业务发送失败!", ex));
            }
        }
Ejemplo n.º 12
0
 public object GetUsedPhrase(string userid, string lx)
 {
     DataSet dataSet = null;
     IDbTransaction tran = Utility.Database.BeginDbTransaction();//开始事务并返回一个事务对象
     SkyLandDeveloper developer = new SkyLandDeveloper("{}", userid, tran);//获取业务流相关参数
     try
     {
         GetUsedPhraseDataModel data = new GetUsedPhraseDataModel();
         List<Para_UsedPhrase> usedPhraseList = new List<Para_UsedPhrase>();
         //Para_UsedPhrase list = new Para_UsedPhrase();
         //list.Condition.Add("cjrid = " + userid);//设置查询条件,条件为当前用户ID
         //list.Condition.Add("lx = " + lx);//设置查询条件,条件为常用语类型
         //data.usedPhraseList = Utility.Database.QueryList(list);
         dataSet = Utility.Database.ExcuteDataSet("select * from Para_UsedPhrase where cjrid='" + userid + "' and lx='" + lx + "' order by sypl desc", tran);
         if (dataSet != null && dataSet.Tables.Count > 0 && dataSet.Tables[0] != null)
         {
             string jsonData = JsonConvert.SerializeObject(dataSet.Tables[0]);
             usedPhraseList = (List<Para_UsedPhrase>)JsonConvert.DeserializeObject(jsonData, typeof(List<Para_UsedPhrase>));
         }
         else
         {
             usedPhraseList = new List<Para_UsedPhrase>();
         }
         Para_UsedPhrase userPhrase = new Para_UsedPhrase();
         userPhrase.lx = lx;
         userPhrase.cjrid = userid;
         userPhrase.cjsj = DateTime.Now;
         Utility.Database.Commit(tran);
         return new
         {
             usedPhraseList = usedPhraseList,
             userPhrase = userPhrase
         };
     }
     catch (Exception ex)
     {
         Utility.Database.Commit(tran);
         ComBase.Logger(ex);//写日专到本地文件
         return Utility.JsonMsg(false, ex.Message);
     }
     finally
     {
         if (dataSet != null) dataSet.Dispose();
         tran.Dispose();
     }
 }
Ejemplo n.º 13
0
        public string PrintSendDocContent(string content, string userid)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper("{}", userid, tran);
            try
            {
                dynamic jdata = JValue.Parse(content);
                string fwrqString = jdata["fwrqString"];//fwrqString
                string printType = jdata["printType"];//printType
                string caseid = jdata["caseid"];
                string strFileName = "发文正文_";
                strFileName += DateTime.Now.ToString("yyyyMMddHHmmss") + "_temporary";
                strFileName += ".docx";
                string sendContentPath = CommonFunctional.GetDocumentPathByName("SendDocContent", "FileDir");
                string targetPath = sendContentPath + strFileName;
                string savePath = "SendDocContent#" + strFileName;

                string realFileName = "";
                switch (printType)
                {
                    case "1":
                        realFileName = "南宁市“美丽南宁 清洁水源”专项活动领导小组文件中红头.docx";
                        break;
                    case "2":
                        realFileName = "南宁市“美丽南宁 清洁水源”专项活动领导小组小红头.docx";
                        break;
                    case "3":
                        realFileName = "南宁市规划环境影响评价工作领导小组办公室文件红头.docx";
                        break;
                    case "4":
                        realFileName = "南宁市环保专项行动领导小组办公室上报红头文件.docx";
                        break;
                    case "5":
                        realFileName = "南宁市环保专项行动领导小组办公室文件红头.docx";
                        break;
                    case "6":
                        realFileName = "南宁市环保专项行动领导小组办公室小红头.docx";
                        break;
                    case "7":
                        realFileName = "南宁市环境保护局上报红头文件.docx";
                        break;
                    case "8":
                        realFileName = "南宁市环境保护局小红头.docx";
                        break;
                    case "9":
                        realFileName = "南宁市环境保护局中红头.docx";
                        break;
                    case "10":
                        realFileName = "南宁市环境保护委员会办公室文件红头(新).docx";
                        break;
                    case "11":
                        realFileName = "南宁市环境保护委员会办公室文件上报红头.docx";
                        break;
                    case "12":
                        realFileName = "南宁市环境保护委员会办公室小红头.docx";
                        break;
                    case "14":
                        realFileName = "中共南宁市环境保护局党组上报红头.docx";
                        break;
                }
                string modelPath = CommonFunctional.GetDocumentPathByName("Send", "FileModelDir");

                //选择模版,将模版复制出一份
                //通过caseid查找发文,并将字号贴上
                B_OA_SendDoc sendDoc = new B_OA_SendDoc();
                sendDoc.Condition.Add("caseid=" + caseid);
                sendDoc = Utility.Database.QueryObject(sendDoc, tran);
                string fwzh = sendDoc.fwzh;
                Dictionary<string, Object> dict = new Dictionary<string, Object>();
                dict.Add("fwzh", fwzh == "" ? "" : fwzh);//发文字号
                realFileName = modelPath + realFileName;
                //将字号赋到文档的相应位置
                IWorkFlow.OfficeService.IWorkFlowOfficeHandler.ProduceWord2007UP(realFileName,targetPath, dict);

                //获取正文的路径
                B_Common_CreateDoc createDoc = new B_Common_CreateDoc();
                createDoc.Condition.Add("caseid=" + caseid);
                createDoc.Condition.Add("docType=" + "mainBody");
                createDoc = Utility.Database.QueryObject(createDoc, tran);
                if (createDoc == null)
                {
                    throw (new Exception("选择模版失败:此发文未生成过正文,请编辑正文后再选择模版!"));
                }

                string fileName = createDoc.filename.Replace("#", "/");
                string filePath = CommonFunctional.GetDocumentPathByName("", "") + fileName;
                if (!File.Exists(filePath))
                {
                    developer.RollBack();
                    return Utility.JsonResult(false, "此正文路径不存在,无法套红");
                }
                //删除旧的套红过的源数据
                B_Common_CreateDoc delDoc = new B_Common_CreateDoc();
                delDoc.Condition.Add("caseid = " + caseid);
                delDoc.Condition.Add("type = " + "SendDoc");
                delDoc.Condition.Add("docType = " + "redCover");
                delDoc = Utility.Database.QueryObject<B_Common_CreateDoc>(delDoc);
                if (delDoc != null)
                {
                    delDoc.Condition.Add("id =" + delDoc.id);
                    Utility.Database.Delete(delDoc, tran);
                }
                //存入新的套红模版路径
                B_Common_CreateDoc redCover = new B_Common_CreateDoc();
                redCover.caseid = caseid;
                redCover.type = "SendDoc";
                redCover.filename = savePath;
                redCover.createdate = DateTime.Now;
                redCover.createman = userid;
                redCover.docType = "redCover";
                Utility.Database.Insert(redCover, tran);
                //将发文的正文路径
                GetDataModel dataModel = new GetDataModel();
                dataModel.mainBodyPath = filePath;
                dataModel.redCoverPath = targetPath;
                Utility.Database.Commit(tran);
                return Utility.JsonResult(true, "发送成功!", dataModel);
            }
            catch (Exception ex)
            {
                developer.RollBack();
                ComBase.Logger(ex);
                return Utility.JsonResult(false, "选择模版失败:" + ex.Message.Replace(":", " "));
            }
        }
Ejemplo n.º 14
0
 public string GetJsxmSelect(string qydm, string userid)
 {
     IDbTransaction tran = Utility.Database.BeginDbTransaction();//开始事务并返回一个事务对象
     SkyLandDeveloper developer = new SkyLandDeveloper("{}", userid, tran);
     DataSet dataSet = null;
     try
     {
         StringBuilder sql = new StringBuilder();
         //sql.Append("select a.*,jsxmbh,xmmc,jsdd,jsnr,jsxz,ztz,bgspzwh,lxbm,bgsspbm from (select * from Base_Unitinfo where qydm='{0}') as a ");
         //sql.Append("left join B_CP_ExamApprovalMain as b on a.qydm=b.jsdw_dm; ");
         //string sqlString = string.Format(sql.ToString(), qydm);
         sql.Append("select * from B_CP_ExamApprovalMain ");
         string sqlString = sql.ToString();
         dataSet = Utility.Database.ExcuteDataSet(sqlString, tran);
         developer.Commit();//提交事务
         string data = JsonConvert.SerializeObject(dataSet.Tables[0]);
         return JsonConvert.SerializeObject(data);
     }
     catch (Exception ex)
     {
         developer.RollBack();//回滚事务
         ComBase.Logger(ex);//写日专到本地文件
         return Utility.JsonMsg(false, ex.Message);
     }
     finally
     {
         tran.Dispose();
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// 封装的发送,通过委托保存数据
        /// </summary>
        /// <param name="BizParams"></param>
        /// <param name="userid"></param>
        /// <param name="saveData"></param>
        /// <param name="CaseName"></param>
        public static void send(string BizParams, string userid, Action<IDbTransaction, string> saveData, string CaseName)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
            try
            {
                //SaveDataModel data = JsonConvert.DeserializeObject<SaveDataModel>(content);
                string caseid = developer.caseid;

                if (String.IsNullOrEmpty(caseid))
                {
                    //developer.caseName = data.baseInfo.traveler + "-出差申请";// 设置流程实例标题
                    //developer.wfcase.caseName= data.baseInfo.traveler + "-出差申请"; //这种写法也可以
                    developer.wfcase.caseName = CaseName;
                    caseid = developer.Create();//生成一个业务流ID
                }

                saveData(tran, caseid);
                developer.Send();
                developer.Commit();
                //return Utility.JsonResult(true, "发送成功!");
            }
            catch (Exception ex)
            {
                developer.RollBack();
                ComBase.Logger(ex);
                throw (new Exception("业务发送失败!", ex));
            }
        }
Ejemplo n.º 16
0
 public string Send(string BizParams, string userid, string content)
 {
     IDbTransaction tran = Utility.Database.BeginDbTransaction();
     SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
     try
     {
         SaveDataModel data = JsonConvert.DeserializeObject<SaveDataModel>(content);
         string caseid = developer.caseid;
         if (String.IsNullOrEmpty(caseid))
         {
             string unitName = ComClass.GetUserInfo(data.fixedAssets.applyManId).CnName;
             string titleType = "采购申请";
             developer.caseName = unitName + "-" + titleType;
             caseid = developer.Create();
         }
         SaveData(data, tran, caseid, developer.wfcase.actid);
         developer.Send();
         developer.Commit();
         return Utility.JsonMsg(true, "发送成功!");
     }
     catch (Exception ex)
     {
         Utility.Database.Rollback(tran);
         ComBase.Logger(ex);
         return Utility.JsonMsg(false, "发送失败:" + ex.Message.Replace(":", " "));
     }
 }
Ejemplo n.º 17
0
        public string Send(string BizParams, string userid, string content)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
            try
            {
                GetDataModel data = JsonConvert.DeserializeObject<GetDataModel>(content);
                string caseid = developer.caseid;
                if (String.IsNullOrEmpty(caseid))
                {
                    string unitName = data.baseInfo.wjmc;
                    string titleType = "来文";
                    developer.caseName = unitName + "-" + titleType;
                    caseid = developer.Create();
                }
                if (developer.wfcase.actid == "A001")
                {
                    //来文编号
                    B_OA_FileType fileType = new B_OA_FileType();
                    fileType.Condition.Add("FileTypeId =" + data.baseInfo.lwdwTypeId);
                    fileType = Utility.Database.QueryObject<B_OA_FileType>(fileType, tran);
                    int code = int.Parse(fileType.remark) + 1;
                    fileType.remark = code.ToString();
                    fileType.Condition.Add("FileTypeId =" + data.baseInfo.lwdwTypeId);
                    Utility.Database.Update(fileType, tran);

                    data.baseInfo.code = data.baseInfo.code + "-" + code;

                }
                SaveData(data, tran, caseid);
                //SetCaseName(data, developer);
                developer.Send();
                developer.Commit();
                return Utility.JsonMsg(true, "发送成功!");
            }
            catch (Exception ex)
            {
                developer.RollBack();
                ComBase.Logger(ex);
                throw (new Exception("业务发送失败!", ex));
            }
        }
Ejemplo n.º 18
0
 public string PrintSendDocContent(string content, string userid)
 {
     IDbTransaction tran = Utility.Database.BeginDbTransaction();
     SkyLandDeveloper developer = new SkyLandDeveloper("{}", userid, tran);
     try
     {
         string rootPath = HttpContext.Current.Server.MapPath("/");
         rootPath = rootPath.Replace("\\", "/");
         dynamic jdata = JValue.Parse(content);
         string fwrqString = jdata["fwrqString"];//fwrqString
         string printType = jdata["printType"];//printType
         string caseid = jdata["caseid"];
         string fwzh = jdata["fwzh"];
         string strFileName = "发文正文_";
         strFileName += DateTime.Now.ToString("yyyyMMddHHmmss") + "_temporary";
         strFileName += ".docx";
         string targetpath = rootPath + "officeFile/SendDocContent/" + strFileName;
         string savePath = "officeFile/SendDocContent/" + strFileName;
         string realFileName = "";
         switch (printType)
         {
             case "1":
                 realFileName = "officeFileModel/SendZhiDui/南宁市环境监察支队文件中红头.docx";
                 break;
             case "2":
                 realFileName = "officeFileModel/SendZhiDui/南宁市环境监察支队小红头.docx";
                 break;
         }
         //选择模版,将模版复制出一份
         //通过caseid查找发文,并将字号贴上
         B_OA_SendDoc_ZhiDui sendDoc = new B_OA_SendDoc_ZhiDui();
         sendDoc.Condition.Add("caseid=" + caseid);
         sendDoc = Utility.Database.QueryObject(sendDoc, tran);
         Dictionary<string, Object> dict = new Dictionary<string, Object>();
         dict.Add("fwzh", fwzh == "" ? "" : fwzh);//发文字号
         realFileName = rootPath + realFileName;
         //将字号赋到文档的相应位置
         IWorkFlow.OfficeService.IWorkFlowOfficeHandler.ProduceWord2007UP(realFileName, targetpath, dict);
         //获取正文的路径
         B_Common_CreateDoc createDoc = new B_Common_CreateDoc();
         createDoc.Condition.Add("caseid=" + caseid);
         createDoc.Condition.Add("docType=" + "mainBody");
         createDoc = Utility.Database.QueryObject(createDoc, tran);
         if (createDoc == null)
         {
             return Utility.JsonMsg(false, "选择模版失败:此发文未生成过正文,请编辑正文后再选择模版!");
         }
         string fileName = createDoc.filename.Replace("#", "/");
         string filePath = rootPath + fileName;
         if (!File.Exists(filePath))
         {
             developer.RollBack();
             return Utility.JsonMsg(false, "此模版路径不存在,无法套红");
         }
         //删除旧的套红过的源数据
         B_Common_CreateDoc delDoc = new B_Common_CreateDoc();
         delDoc.Condition.Add("caseid = " + caseid);
         delDoc.Condition.Add("type = " + "SendDocZhiDui");
         delDoc.Condition.Add("docType = " + "redCover");
         delDoc = Utility.Database.QueryObject<B_Common_CreateDoc>(delDoc);
         if (delDoc != null)
         {
             delDoc.Condition.Add("id =" + delDoc.id);
             Utility.Database.Delete(delDoc, tran);
         }
         //存入新的套红模版路径
         B_Common_CreateDoc redCover = new B_Common_CreateDoc();
         redCover.caseid = caseid;
         redCover.type = "SendDocZhiDui";
         redCover.filename = savePath.Replace("/", "#");
         redCover.createdate = DateTime.Now;
         redCover.createman = userid;
         redCover.docType = "redCover";
         Utility.Database.Insert(redCover, tran);
         //将发文的正文路径
         GetDataModel dataModel = new GetDataModel();
         dataModel.mainBodyPath = rootPath + createDoc.filename.Replace("#", "/");
         dataModel.redCoverPath = rootPath + redCover.filename.Replace("#", "/");
         Utility.Database.Commit(tran);
         return JsonConvert.SerializeObject( dataModel);
     }
     catch (Exception ex)
     {
         developer.RollBack();
         ComBase.Logger(ex);
         return Utility.JsonMsg(false, "选择模版失败:" + ex.Message.Replace(":", " "));
     }
 }
Ejemplo n.º 19
0
        public string Send(string BizParams, string userid, string content)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
            try
            {
                SaveDataModel data = JsonConvert.DeserializeObject<SaveDataModel>(content);// new SaveDataModel();

                string caseid = developer.caseid;
                if (String.IsNullOrEmpty(caseid))
                {
                    string unitName = data.sendDocBaseInfo.wjbt;
                    string titleType = "发文";
                    developer.caseName = unitName + "-" + titleType;
                    caseid = developer.Create();
                }

                if (developer.wfcase.actid == "A001")
                {
                    //当此文未草稿的时候并未生成caseid,而存的是guid,此步骤是将正文路径的caseid字段修改成caseid
                    ChangeGuidToCaseId(developer.wfcase.guid, caseid, tran);
                    //业务关联表
                    if (data.sendRelation != null)
                    {
                        data.sendRelation.caseId = caseid;
                        Utility.Database.Insert(data.sendRelation, tran);
                    }
                }

                ////发文字号的生成
                //if (developer.wfcase.actid == "A007")
                //{
                //    DocNumberRule docNumber = new DocNumberRuleSvc().CreateDocNumber("发文");
                //    data.sendDocBaseInfo.fwzh = string.Format(docNumber.gz, docNumber.nf, docNumber.dqz);
                //}

                //当发文在最后一部时候将相应内容归入文档中心的相应目录
                if (developer.wfcase.actid == "A009")
                {
                    SaveToNotice(tran, caseid, userid);
                }

                SaveData(data, tran, caseid);
                developer.Send();
                developer.Commit();
                return Utility.JsonResult(true, "发送成功!");
            }
            catch (Exception ex)
            {
                developer.RollBack();
                ComBase.Logger(ex);
                throw (new Exception("业务发送失败!", ex));
            }
        }
Ejemplo n.º 20
0
        public string Send(string BizParams, string userid, string content)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
            try
            {
                GetDataModel data = JsonConvert.DeserializeObject<GetDataModel>(content);// new SaveDataModel();

                string caseid = developer.caseid;
                if (String.IsNullOrEmpty(caseid))
                {
                    string unitName = data.sendDocBaseInfo.title;
                    string titleType = "发文";
                    developer.caseName = unitName + "-" + titleType;
                    caseid = developer.Create();
                }

                if (developer.wfcase.actid == "A001")
                {
                    //当此文未草稿的时候并未生成caseid,而存的是guid,此步骤是将正文路径的caseid字段修改成caseid
                    CommonFunctional.ChangeGuidToCaseId(developer.wfcase.guid, caseid, tran);
                }
                SaveData(data, tran, caseid);
                developer.Send();
                developer.Commit();
                return Utility.JsonMsg(true, "发送成功!");
            }
            catch (Exception ex)
            {
                Utility.Database.Rollback(tran);
                ComBase.Logger(ex);
                throw (new Exception("业务发送失败!", ex));
            }
        }
Ejemplo n.º 21
0
 public string Send(string BizParams, string userid, string content)
 {
     IDbTransaction tran = Utility.Database.BeginDbTransaction();
     SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
     try
     {
         SaveDataModel data = JsonConvert.DeserializeObject<SaveDataModel>(content);
         string caseid = data.baseInfo.caseId;
         if (caseid == null || caseid.Equals(""))
         {
             caseid = developer.Create();//生成一个业务流ID
         }
         if (developer.wfcase.actid == "A001")
         {
             data.baseInfo.createDate = DateTime.Now;
             developer.caseName = ComClass.GetUserInfo(userid).CnName + "-请假申请";
         }
         SaveData(data, tran, caseid);
         developer.Send();
         developer.Commit();
         return Utility.JsonResult(true, "发送成功!");
     }
     catch (Exception ex)
     {
         developer.RollBack();
         ComBase.Logger(ex);
         return Utility.JsonResult(false, "发送失败:" + ex.Message.Replace(":", " "));
     }
 }
Ejemplo n.º 22
0
        public string Send(string BizParams, string userid, string content)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
            try
            {
                GetDataModel data = JsonConvert.DeserializeObject<GetDataModel>(content);
                string caseid = developer.caseid;
                if (String.IsNullOrEmpty(caseid))
                {
                    string unitName = data.baseInfo.wjmc;
                    string titleType = "来文";
                    developer.caseName = unitName + "-" + titleType;
                    caseid = developer.Create();
                }

                SaveData(data, tran, caseid);
                //SetCaseName(data, developer);
                developer.Send();
                developer.Commit();
                return Utility.JsonResult(true, "发送成功!");
            }
            catch (Exception ex)
            {
                developer.RollBack();
                ComBase.Logger(ex);
                throw (new Exception("业务发送失败!", ex));
            }
        }
Ejemplo n.º 23
0
 public void SetCaseName(GetDataModel data, SkyLandDeveloper developer)
 {
     try
     {
         string unitName = data.supervisionBaseInfo.title;
         string titleType = "交办事项督办";
         developer.caseName = unitName + "-" + titleType;
     }
     catch (Exception ex)
     {
         ComBase.Logger(ex);
     }
 }
Ejemplo n.º 24
0
 public string Send(string BizParams, string userid, string content)
 {
     IDbTransaction tran = Utility.Database.BeginDbTransaction();
     SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
     try
     {
         SaveDataModel data = JsonConvert.DeserializeObject<SaveDataModel>(content);
         string caseid = developer.Create();
         SaveData(data, tran, caseid);
         SetCaseName(data, developer);
         developer.Send();
         developer.Commit();
         return Utility.JsonMsg(true, "发送成功!");
     }
     catch (Exception ex)
     {
         developer.RollBack();
         ComBase.Logger(ex);
         return Utility.JsonMsg(false, "发送失败:" + ex.Message.Replace(":", " "));
     }
 }
Ejemplo n.º 25
0
 public void SetCaseName(GetDataModel data, SkyLandDeveloper developer)
 {
     try
     {
         string unitName = data.delayApplyBaseInfor.title;
         string titleType = "督办延期申请";
         developer.caseName = unitName + "-" + titleType;
     }
     catch (Exception ex)
     {
         ComBase.Logger(ex);
     }
 }
Ejemplo n.º 26
0
 /// <summary>
 /// 设置流程实例标题
 /// </summary>
 /// <param name="data"></param>
 /// <param name="deveoloper"></param>
 public void SetCaseName(SaveDataModel data, SkyLandDeveloper deveoloper)
 {
     string unitName = data.baseInfo.sqks;
     string titleType = "会议申请";
     deveoloper.caseName = unitName + "-" + titleType;
 }
Ejemplo n.º 27
0
 /// <summary>
 /// 设置流程实例标题
 /// </summary>
 /// <param name="data"></param>
 /// <param name="deveoloper"></param>
 public void SetCaseName(GetDataModel data, SkyLandDeveloper deveoloper)
 {
     string unitName = data.sendDocBaseInfo.title;
     string titleType = "环境科学研修所发文";
     deveoloper.caseName = unitName + "-" + titleType;
 }
        public string Send(string BizParams, string userid, string content)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
            try
            {
                GetDataModel data = JsonConvert.DeserializeObject<GetDataModel>(content);

                string caseid = developer.caseid;
                if (String.IsNullOrEmpty(caseid))
                {
                    string unitName = data.baseInfor_Notice.NewsTitle;
                    string titleType = "文档发布";
                    developer.caseName = unitName + "-" + titleType;
                    caseid = developer.Create();

                }

                //string validateInfor = ValiadateInput(data.baseInfor_Notice);

                //if (validateInfor.Length > 0)
                //{
                //    developer.RollBack();
                //    return Utility.JsonResult(false, validateInfor);
                //}

                //保存数据
                if (developer.wfcase.actid == "A002")
                {
                    data.baseInfor_Notice.status = "checkThrough";
                    data.baseInfor_Notice.isSeeInDoor = true;
                    //邮件送达
                    if (data.baseInfor_Notice.isSendEmail == true)
                    {
                        SendEmail(data.baseInfor_Notice, tran,userid);
                    }
                }

                SaveData(data, tran, caseid, userid);
                //SetCaseName(data, developer);
                developer.Send();
                developer.Commit();
                return Utility.JsonResult(true, "发送成功!");

            }
            catch (Exception ex)
            {
                developer.RollBack();
                ComBase.Logger(ex);
                throw (new Exception("业务发送失败!", ex));
            }
        }
Ejemplo n.º 29
0
        public string Send(string BizParams, string userid, string content)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
            try
            {
                GetDataModel data = JsonConvert.DeserializeObject<GetDataModel>(content);
                string caseid = developer.caseid;
                if (String.IsNullOrEmpty(caseid))
                {
                    string unitName = data.sendDocBaseInfo.title;
                    string titleType = "内部事项";
                    developer.caseName = unitName + "-" + titleType;
                    caseid = developer.Create();
                }
                if (developer.wfcase.actid == "A001")
                {
                    string strSql = "select Max(substring(code,9,5)) from B_OA_SendDoc_Inner_QuZhan";
                    DataSet ds = Utility.Database.ExcuteDataSet(strSql, tran);
                    string code = ds.Tables[0].Rows[0][0].ToString();
                    if (code == "")
                    {
                        data.sendDocBaseInfo.code = "NB[" + DateTime.Now.Year.ToString() + "]00001";
                    }
                    else
                    {
                        data.sendDocBaseInfo.code = "NB[" + DateTime.Now.Year + "]" + (int.Parse(code) + 1).ToString();
                    }

                }
                SaveData(data, tran, caseid);
                //SetCaseName(data, developer);
                developer.Send();
                developer.Commit();
                return Utility.JsonResult(true, "发送成功!");
            }
            catch (Exception ex)
            {
                developer.RollBack();
                ComBase.Logger(ex);
                throw (new Exception("业务发送失败!", ex));
            }
        }
Ejemplo n.º 30
0
        public string Send(string BizParams, string userid, string content)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran);
            try
            {
                GetDataModel data = JsonConvert.DeserializeObject<GetDataModel>(content);
                string caseid = developer.caseid;
                if (String.IsNullOrEmpty(caseid))
                {
                    string unitName = data.baseInfor_Notice.NewsTitle;
                    string titleType = "通知公告";
                    developer.caseName = unitName + "-" + titleType;
                    caseid = developer.Create();
                }

                //保存数据
                if (developer.wfcase.actid == "A003")
                {
                    data.baseInfor_Notice.status = "1";
                    data.baseInfor_Notice.Chk = "1";
                    data.baseInfor_Notice.isSeeInDoor = true;
                }
                SaveData(data, tran, caseid, userid);
                SetCaseName(data, developer);
                developer.Send();
                developer.Commit();
                return Utility.JsonMsg(true, "发送成功!");

            }
            catch (Exception ex)
            {
                developer.RollBack();
                ComBase.Logger(ex);
                throw (new Exception("业务发送失败!", ex));
            }
        }