示例#1
0
文件: Xm_sxhb.cs 项目: hzlloach/EPBMS
        /// <summary>
        /// 提交
        /// </summary>
        public static void Submit(string xsbh, string hbbh)
        {
            // 判断汇报内容长度
            Model.Xmgl.Xm_sxhbmx mx = GetEntity <Model.Xmgl.Xm_sxhbmx>("Hbbh", hbbh);
            if (mx.Hbnr.Length < 800 || mx.Hbnr.Length > 1500)
            {
                throw new Exception(string.Format("汇报内容必须 800 ~ 1500 个汉字【当前 <span style='color:red'><b>{0}</b></span> 字】 !", mx.Hbnr.Length));
            }

            // 获取V_xm_sxhb
            Model.Xmgl.V_xm_sxhb vtx = GetEntity <Model.Xmgl.V_xm_sxhb>(hbbh);
            string   xm       = vtx.Xm;
            string   fzztdm   = vtx.Fzztdm;
            string   lxr      = vtx.Lxrxm;
            string   sjhm     = vtx.Lxrsjhm;
            DateTime dtTjjzrq = DateTime.Parse(vtx.Tjjzsj); // 显示的是1号,实际为上月末(即前一秒)

            TG.SystemSetting.Status ztdm = TU.Common.ConvertHelper.EnumParse <TStar.Web.Globals.SystemSetting.Status>(vtx.Ztdm.ToString());
            int month = (fzztdm == "5" || fzztdm == "6") ? 3 : 2;

            // 保存Xm_sxhb
            string czsj = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            Model.Xmgl.Xm_sxhb hb = new Model.Xmgl.Xm_sxhb();
            hb.Pkid   = hbbh;
            hb.Tjsj   = czsj;
            hb.Pyjzsj = DateTime.Now.AddDays(14).ToString("yyyy-MM-dd 23:59:59");
            hb.Pytxsj = DateTime.Now.AddDays(9).ToString("yyyy-MM-dd 23:59:59");
            hb.Ztdm   = (int)TG.SystemSetting.Status.Submitted;
            string[] fields = new string[] { "Tjsj", "Pyjzsj", "Pytxsj", "Ztdm" };
            if (ztdm == TG.SystemSetting.Status.Draft)
            {
                hb.Yf  = (DateTime.Now < dtTjjzrq ? DateTime.Now : dtTjjzrq.AddDays(-1)).ToString("yyyy年MM月");
                fields = new string[] { "Yf", "Tjsj", "Pyjzsj", "Pytxsj", "Ztdm" };
            }
            UpdateFields <Model.Xmgl.Xm_sxhb>(hb, fields);

            // 修改Xm_sxhbtx
            if (ztdm == TG.SystemSetting.Status.Draft) // 新思想汇报且提交截止时间>=下一次提交截止时间时才修改
            {
                string where = string.Format("Pkid='{0}' AND Tjjzsj<='{1}'", xsbh, dtTjjzrq.ToString("yyyy-MM-dd HH:mm:ss"));
                dtTjjzrq     = dtTjjzrq.AddMonths(month);

                fields = new string[] { "Tjjzsj", "Tjtxsj" };
                string[] keys = { dtTjjzrq.ToString("yyyy-MM-dd HH:mm:ss"), dtTjjzrq.AddDays(-16).ToString("yyyy-MM-dd 23:59:59") };
                UpdateFields <Model.Xmgl.Xm_sxhbtx>(fields, keys, where);
            }

            string title = "提交了修改";

            switch (ztdm)
            {
            case TG.SystemSetting.Status.Draft:
                title = "提交了新";
                break;

            case TG.SystemSetting.Status.InModify:
                title = "提交了退回修改后";
                break;

            case TG.SystemSetting.Status.InRewrite:
                title = "提交了退回重写后";
                break;
            }

            // 提交时生成短信提醒记录
            Model.Xtgl.Xt_dxfs dx = new Model.Xtgl.Xt_dxfs();
            dx.Dxlb = "02";
            dx.Jsr  = lxr;
            dx.Sjhm = sjhm.Substring(0, 11);
            dx.Nr   = string.Format("【{0}】联系人,您好!【{1}】刚{2}的思想汇报,请您于{3}前完成评阅 !", dx.Jsr, xm, title, hb.Pyjzsj);
            dx.Fssj = dx.Bcsj = czsj;
            dx.Ztdm = "0";

            try
            {
                string s = Globals.WsSms.SendMsg(dx.Sjhm, dx.Nr);
                dx.Ztdm = "2";
            }
            catch (Exception err)
            {
                dx.Ztdm = "1";
                dx.Sbyy = err.Message;
            }
            finally
            {
                Insert <Model.Xtgl.Xt_dxfs>(dx);
            }
        }
示例#2
0
文件: Xm_sxhb.cs 项目: hzlloach/EPBMS
        /// <summary>
        /// 审核
        /// </summary>
        public static void Audit(Model.Xmgl.Xm_sxhbmx mx, string shrbh, string ztdm)
        {
            // 判断评阅意见长度
            if (mx.Pyyj.Length < 20 || mx.Pyyj.Length > 100)
            {
                throw new Exception(string.Format("评阅意见必须 20 ~ 100 个汉字【当前 <span style='color:red'><b>{0}</b></span> 字】 !", mx.Pyyj.Length));
            }

            // 保存Xm_sxhbmx
            string where = string.Format("Hbbh='{0}'", mx.Hbbh);
            UpdateFields <Model.Xmgl.Xm_sxhbmx>("Pyyj", mx.Pyyj, where);

            // 保存Xm_sxhb
            bool   isBack = false;
            string title  = "";
            string czsj   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            switch (TU.Common.ConvertHelper.EnumParse <TG.SystemSetting.Status>(ztdm))
            {
            case TG.SystemSetting.Status.ToBeModified:
                isBack = true;
                title  = "修改";
                break;

            case TG.SystemSetting.Status.ToBeRewritten:
                isBack = true;
                title  = "重写";
                break;
            }

            Model.Xmgl.V_xm_sxhb_cur hb = isBack ? GetEntity <Model.Xmgl.V_xm_sxhb_cur>(mx.Hbbh) : null;
            where = string.Format("Pkid='{0}'", mx.Hbbh);
            UpdateFields <Model.Xmgl.Xm_sxhb>(new string[] { "Shrbh", "Pysj", "Ztdm" }, new string[] { shrbh, czsj, ztdm }, where);

            // 退回时生成短信提醒记录
            if (isBack)
            {
                Model.Xtgl.Xt_dxfs dx = new Model.Xtgl.Xt_dxfs();
                dx.Dxlb = "02";
                dx.Jsr  = hb.Xm;
                dx.Sjhm = hb.Sjhm.Substring(0, 11);
                dx.Nr   = string.Format("【{0}】,您好!您有思想汇报被退回要求{1},请尽快处理 !", dx.Jsr, title);
                dx.Fssj = dx.Bcsj = czsj;
                dx.Ztdm = "0";

                try
                {
                    WSSmsService.SmsServiceSoapClient WsSms = new WSSmsService.SmsServiceSoapClient();
                    string s = WsSms.SendMsg(dx.Sjhm, dx.Nr);
                    dx.Ztdm = "2";
                }
                catch (Exception err)
                {
                    dx.Ztdm = "1";
                    dx.Sbyy = err.Message;
                }
                finally
                {
                    Insert <Model.Xtgl.Xt_dxfs>(dx);
                }
            }
        }