private YYApply GetYYApply(string token, YYApply YYApply, int Times = 0)
 {
     if (YYApply.State == 1)
     {
         int ApplyId = Int32.Parse(YYApply.ApplyId);
         GetDeviceStatusResultJson DeviceStatus = WXAPI.DeviceApplyStatus(token, ApplyId);
         if (DeviceStatus.errcode == ReturnCode.请求成功)
         {
             if (DeviceStatus.data.audit_status == 2)
             {
                 YYApply.State = 2;
             }
             if (DeviceStatus.data.audit_status == 0)
             {
                 YYApply.State = 0;
             }
         }
     }
     if (YYApply.State == 1)
     {
         if (Times < 10)
         {
             Thread.Sleep(5000);
             return(GetYYApply(token, YYApply, Times++));
         }
     }
     return(YYApply);
 }
예제 #2
0
    /*
     * protected override void OnInit(System.EventArgs e)
     * {
     *  this.code = base.Request["code"];
     *  this.userID = base.Request["userID"];
     *  this.keyID = base.Request["Id"];
     *  base.OnInit(e);
     * }
     */
    protected void Page_Load(object sender, EventArgs e)
    {
        //1000012 appid
        userID = WXAPI.getUserIdByCode(code, "1000011");    //"00200002";//WXAPI.getUserIdByCode(code, "1000012"); //"00200002";//


        if (!IsPostBack)
        {
            if (string.IsNullOrEmpty(keyID))
            {
                string    strSql = "select top 1 Id from OA_File where Id=ParentId";
                DataTable dt     = publicDbOpClass.DataTableQuary(strSql);
                if (dt.Rows.Count > 0)
                {
                    keyID = dt.Rows[0]["Id"].ToString();
                    //ParentId.Value = dt.Rows[0]["ParentId"].ToString();
                }

                bindMenuHead(dt.Rows[0]["Id"].ToString(), 0);
            }
            else
            {
                bindMenuHead(keyID, 1);
            }
        }
    }
예제 #3
0
    //同步组织机构和员工到微信
    //protected void btnTBtoWX_Click(object sender, EventArgs e)
    //{
    //    DataTable dt1 = this.hrAction.GetDepartment();
    //    if (dt1.Rows.Count > 0)
    //    {
    //        foreach (DataRow dataRow in dt1.Rows)
    //        {
    //            string strResult = WXAPI.createWXdpt(dataRow);
    //        }
    //        foreach (DataRow dataRow in dt1.Rows)
    //        {
    //            string strResult = WXAPI.updateWXdpt(dataRow);
    //        }
    //    }

    //    DataTable dt2 = this.hrAction.GetUsers();
    //    if (dt2.Rows.Count > 0)
    //    {
    //        foreach (DataRow dataRow in dt2.Rows)
    //        {
    //            string strResult = WXAPI.createWXry(dataRow);
    //        }
    //        foreach (DataRow dataRow in dt2.Rows)
    //        {
    //            string strResult = WXAPI.createWXry(dataRow);
    //        }
    //    }
    //    this.JS.Text = "top.ui.alert('同步到微信成功!');";
    //}
    //同步员工(微信->本地)
    protected void btnFromWX_Click(object sender, EventArgs e)
    {
        string strResult = WXAPI.getWXry();

        this.JS.Text = "top.ui.alert('同步员工成功!');";
        //DataTable dt1 = this.hrAction.GetDepartment();
        //if (dt1.Rows.Count > 0)
        //{
        //    foreach (DataRow dataRow in dt1.Rows)
        //    {
        //        string strResult = WXAPI.createWXdpt(dataRow);
        //    }
        //    foreach (DataRow dataRow in dt1.Rows)
        //    {
        //        string strResult = WXAPI.updateWXdpt(dataRow);
        //    }
        //}

        //DataTable dt2 = this.hrAction.GetUsers();
        //if (dt2.Rows.Count > 0)
        //{
        //    foreach (DataRow dataRow in dt2.Rows)
        //    {
        //        string strResult = WXAPI.createWXry(dataRow);
        //    }
        //    foreach (DataRow dataRow in dt2.Rows)
        //    {
        //        string strResult = WXAPI.createWXry(dataRow);
        //    }
        //}
        //this.JS.Text = "top.ui.alert('同步到微信成功!');";
    }
예제 #4
0
    //保存评论
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strSql  = "";
        string strSql1 = "";

        strSql = string.Format(@"
    INSERT INTO [OA_Comment]
           ([id]
           ,[head_id]
           ,[user_id]
           ,[time]
           ,[content])
     VALUES
           (
		    '{0}'--<id, varchar(50),>
           ,'{1}'--,<head_id, varchar(50),>
           ,'{2}'--,<user_id, varchar(50),>
           ,'{3}'--,<time, datetime,>
           ,'{4}'--,<content, text,>
		   )
        ", Guid.NewGuid().ToString(), this.KeyId.Value, base.UserCode.ToString(), DateTime.Now, this.comment_content.Text);


        using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString))
        {
            sqlConnection.Open();
            SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
            try
            {
                SqlHelper.ExecuteNonQuery(sqlTransaction, CommandType.Text, strSql);
                string strs = RYinfo(this.KeyId.Value);
                if (!string.IsNullOrEmpty(strs))
                {
                    strSql1 = @"INSERT INTO [OA_Task_Append]
           ([id]
           ,[task_id]
           ,[user_id]
           --,[look_time]
           --,[progress]
           --,[remark]
           ,[user_type]
           ,[up_time]
		   )
            VALUES " + strs;
                    SqlHelper.ExecuteNonQuery(sqlTransaction, CommandType.Text, strSql1);
                }
                sqlTransaction.Commit();
                //发送微信消息
                WXAPI.sendWeChatMsg(UserCode.ToString(), "", hfldCopyto.Value.ToString(), "taskPL", this.KeyId.Value, title.Text.ToString(), create_date.Text.ToString());

                base.RegisterScriptRefresh();
            }
            catch (Exception ex)
            {
                sqlTransaction.Rollback();
                base.RegisterScript("alert('系统提示:\\n\\保存失败!" + ex.Message.ToString() + "');");
            }
        }
    }
예제 #5
0
 protected override void OnInit(System.EventArgs e)
 {
     this.code = base.Request["code"];
     this.type = base.Request["type"];
     if (HttpContext.Current.Session["yhdm"] == null || HttpContext.Current.Session["yhdm"].ToString().Length > 10)
     {
         try
         {
             string UserID = "";
             if (type == "refundingListWX")
             {
                 UserID = WXAPI.getUserIdByCode(code, "1000020");// "00200002";//
             }
             if (type == "qoRefundingListWX")
             {
                 UserID = WXAPI.getUserIdByCode(code, "1000020");// "00200002";//
             }
             if (type == "outReserveWX")
             {
                 UserID = WXAPI.getUserIdByCode(code, "1000021");// "00200002";//
             }
             if (type == "qOutReserveWX")
             {
                 UserID = WXAPI.getUserIdByCode(code, "1000021");// "00200002";//
             }
             if (type == "wantPlanWX")
             {
                 UserID = WXAPI.getUserIdByCode(code, "1000022");// "00200002";//
             }
             if (type == "purchasePlanWX")
             {
                 UserID = WXAPI.getUserIdByCode(code, "1000022");// "00200002";//
             }
             if (type == "purchaseWX")
             {
                 UserID = WXAPI.getUserIdByCode(code, "1000022");// "00200002";//
             }
             if (type == "planPlaitWX")
             {
                 UserID = WXAPI.getUserIdByCode(code, "1000023");// "00200002";//
             }
             if (type == "planActualRptWX")
             {
                 UserID = WXAPI.getUserIdByCode(code, "1000023");// "00200002";//
             }
             HttpContext.Current.Session["yhdm"] = UserID;
             //HttpContext.Current.Session["PmSet"] = 1;
         }
         catch (Exception ex)
         {
         }
     }
     else
     {
         //HttpContext.Current.Session["yhdm"] = "00200002";
         //this.Session["PmSet"] = 1;
     }
 }
예제 #6
0
파일: show.aspx.cs 프로젝트: zxl881203/src
    [WebMethod]//标示为web服务方法属性
    public static string BindJD(string Id)
    {
        DataTable dtJD    = publicDbOpClass.DataTableQuary(@"select OA_Task_Progress_History.*,PT_yhmc.v_xm,PT_yhmc.WXID from OA_Task_Progress_History left join PT_yhmc on 
                                            OA_Task_Progress_History.user_id=PT_yhmc.v_yhdm where head_id='" + Id + "' order by OA_Task_Progress_History.time desc");
        DataTable dtJDNum = publicDbOpClass.DataTableQuary(@"SELECT top 1 progress FROM OA_Task_Progress_History WHERE head_id='" + Id + "' order by time desc");
        string    strs    = "";

        if (dtJD.Rows.Count > 0)
        {
            foreach (DataRow dr in dtJD.Rows)
            {
                string  imgUrl = "";
                JObject json1  = WXAPI.getUserInfo(dr["WXID"].ToString(), "1000010");
                if (json1 != null)
                {
                    string code = json1["errcode"].ToString();

                    if (code == "0")
                    {
                        imgUrl = json1["avatar"].ToString();
                    }
                    else
                    {
                        imgUrl = "";
                    }
                }
                else
                {
                    imgUrl = "";
                }

                strs += @"<li class='flexbox'>" +
                        "<div class='avator'><img src='" + imgUrl + "' alt=''></div>" +
                        "<div class='comment_content flexItem mapItem'>" +
                        "<h3 class='clearfix'><span class='title'>" + dr["v_xm"].ToString() + "</span><span class='time'>" + Convert.ToDateTime(dr["time"].ToString()).ToString("yyyy-MM-dd HH:mm") + "</span>" +
                        "<input type='hidden' value='" + dr["id"].ToString() + "'>" +
                        "</h3><p class='@class'>进度:" + dr["progress"].ToString() + "% &nbsp;&nbsp;进度说明:" + dr["content"].ToString() + "</p></div> </li>";
            }
        }
        else
        {
            strs = "<li class='flexbox'><p class='@class'>暂无更新记录</p></div> </li>";
        }
        if (dtJDNum.Rows.Count > 0)
        {
            return(dtJDNum.Rows[0]["progress"].ToString() + "%|" + strs);
        }
        else
        {
            return("0%|" + strs);
        }
    }
        private string GetToken()
        {
            string AppId     = ConfigurationManager.AppSettings["wxAppId"].ToString();
            string AppSecret = ConfigurationManager.AppSettings["wxAppSecret"].ToString();

            AccToken = MemoryCacheBuilder.EntityCache.Get("access_token", null) as string;
            if (AccToken.IsNullOrEmpty())
            {
                AccToken = WXAPI.GetToken(AppId, AppSecret, "client_credential").access_token;
                MemoryCacheBuilder.EntityCache.Remove("access_token", null);
                MemoryCacheBuilder.EntityCache.Add("access_token", AccToken, DateTime.Now.AddMinutes(60.0), null);
            }
            return(AccToken);
        }
예제 #8
0
파일: edit.aspx.cs 프로젝트: zxl881203/src
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!base.IsPostBack)
        {
            if (!string.IsNullOrEmpty(userID))
            {
                UserID.Value = userID;//WXAPI.getUserIdByCode(code);
            }
            else
            {
                UserID.Value = WXAPI.getUserIdByCode(code, "1000010"); //"00200002";// WXAPI.getUserIdByCode(code); //"00200002";//
                RegisterScript(UserID.Value);
            }
            this.BindType();     //绑定任务类型
            this.BindPriority(); //绑定任务优先级

            if (this.action == "add")
            {
                this.KeyId.Value = System.Guid.NewGuid().ToString();
            }
            else if (this.action == "edit")
            {
                this.KeyId.Value = Id;
                this.Bind(Id, action);
            }
        }
        else
        {
            string strSubType = submitType.Value.ToString();
            if (!string.IsNullOrEmpty(strSubType))
            {
                if (strSubType == "0")
                {
                    saveData(0);
                }
                if (strSubType == "1")
                {
                    if (Convert.ToDateTime(start_time.Value.ToString()) >= DateTime.Now)
                    {
                        saveData(1);
                    }
                    else
                    {
                        saveData(2);
                    }
                }
            }
        }
    }
예제 #9
0
파일: show.aspx.cs 프로젝트: zxl881203/src
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         if (!string.IsNullOrEmpty(userID))
         {
             UserID.Value = userID;//WXAPI.getUserIdByCode(code);
         }
         else
         {
             UserID.Value = WXAPI.getUserIdByCode(code, "1000010"); //"00200002";//WXAPI.getUserIdByCode(code); //"00200002";//WXAPI.getUserIdByCode(code);
         }
         this.KeyId.Value = Id;
         this.Bind(Id, action);
     }
 }
예제 #10
0
 protected override void OnInit(System.EventArgs e)
 {
     this.code = base.Request["code"];
     if (HttpContext.Current.Session["yhdm"] == null || HttpContext.Current.Session["yhdm"].ToString().Length > 10)
     {
         try
         {
             string UserID = WXAPI.getUserIdByCode(code, "1000017");// "00200002";//
             HttpContext.Current.Session["yhdm"] = UserID;
         }
         catch (Exception ex)
         {
         }
     }
     base.OnInit(e);
     base.InitBasePage();
 }
예제 #11
0
 protected override void OnInit(System.EventArgs e)
 {
     code = base.Request["code"];
     if (HttpContext.Current.Session["yhdm"] == null)
     {
         try
         {
             string UserID = WXAPI.getUserIdByCode(code, "1000015");//
             HttpContext.Current.Session["yhdm"] = UserID;
         }
         catch
         {
             //base.RegisterScript("alert('获取用户信息失败,请稍后重试或联系相关人员!');");
         }
     }
     base.OnInit(e);
     base.InitBasePage();
 }
예제 #12
0
 protected override void OnInit(System.EventArgs e)
 {
     this.code = base.Request["code"];
     if (HttpContext.Current.Session["yhdm"] == null || HttpContext.Current.Session["yhdm"].ToString().Length > 10)
     {
         try
         {
             string UserID = WXAPI.getUserIdByCode(code, "1000014");// "00200002";//
             HttpContext.Current.Session["yhdm"] = UserID;
         }
         catch (Exception ex)
         {
         }
     }
     //this.userType = base.Request["userType"];//用户类型
     //this.status = base.Request["status"];//任务状态
     this.userID = HttpContext.Current.Session["yhdm"].ToString();
 }
예제 #13
0
    private void EditDep()
    {
        try
        {
            int    value  = Convert.ToInt32(this.txtNo.Text.Trim());
            string v_BMMC = this.txtName.Text.Trim();
            PTdbm  byId   = this.dSer.GetById(this.id);
            byId.I_xh   = new int?(value);
            byId.V_BMMC = v_BMMC;
            this.dSer.Update(byId);

            DataTable dt = publicDbOpClass.DataTableQuary("select * from PT_d_bm where i_bmdm = " + this.id);
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dataRow in dt.Rows)
                {
                    try
                    {
                        string strResult = WXAPI.createWXdpt(dt.Rows[0]);
                        if (strResult == "0")
                        {
                            base.RegisterScript("editSucessed();");
                        }
                        else
                        {
                            base.RegisterScript("top.ui.show( '编辑成功,同步到微信失败'); \n top.ui.closeWin(); \n");
                        }
                    }
                    catch
                    {
                        base.RegisterScript("top.ui.show( '编辑成功,同步到微信失败'); \n top.ui.closeWin(); \n");
                    }
                }
            }
            else
            {
                base.RegisterScript("top.ui.show( '编辑成功,同步到微信失败'); \n top.ui.closeWin(); \n");
            }
        }
        catch
        {
            base.RegisterScript("top.ui.show( '编辑失败'); \n top.ui.closeWin(); \n");
        }
    }
예제 #14
0
    protected void btnDelete_Click1(object sender, EventArgs e)
    {
        string    value     = this.hfldDepId.Value;
        string    cmdText   = string.Format("select Count(*) from PT_yhmc where i_bmdm = '{0}'\r\n                                          Union\r\n                                          select Count(*) from PT_DUTY where i_bmdm = '{0}'", value);
        DataTable dataTable = SqlHelper.ExecuteQuery(CommandType.Text, cmdText, new SqlParameter[0]);

        if (dataTable != null && dataTable.Rows.Count > 0)
        {
            int num = 0;
            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                num += DBHelper.GetInt(dataTable.Rows[i][0]);
            }
            if (num == 0)
            {
                string value2 = this.dSer.Delete(value);
                if ("1".Equals(value2))
                {
                    string strResult = WXAPI.deletedWXdpt(value);
                    if (strResult == "0")
                    {
                        base.RegisterScript("alert('系统提示:数据删除成功!');");
                    }
                    else
                    {
                        base.RegisterScript("alert('系统提示:数据删除成功,微信端删除失败!');");
                    }
                    this.DataBindDep();
                    return;
                }
                base.RegisterScript("alert('系统提示:数据删除失败!');");
                return;
            }
            else
            {
                base.RegisterScript("alert('系统提示:\\n\\项目下存在数据,删除失败!');");
            }
        }
    }
예제 #15
0
 protected override void OnInit(System.EventArgs e)
 {
     this.code = base.Request["code"];
     this.type = base.Request["type"];
     if (HttpContext.Current.Session["yhdm"] == null || HttpContext.Current.Session["yhdm"].ToString().Length > 10)
     {
         try
         {
             string UserID = WXAPI.getUserIdByCode(code, "1000008");// "00200002";//
             HttpContext.Current.Session["yhdm"] = UserID;
             this.Session["PmSet"] = 0;
         }
         catch (Exception ex)
         {
         }
     }
     else
     {
         //HttpContext.Current.Session["yhdm"] = "00200002";
         //this.Session["PmSet"] = 0;
     }
 }
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[ZhouBianInfo]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            //JObject pp = (JObject)p;
            Users Users = new Users();

            Users = JsonToObject.ConvertJsonToModel(Users, json);
            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == Users.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)//用户被锁定
            {
                DataObj.OutError("2003");
                return;
            }
            if (baseUsers.CardStae != 2)//未实名认证
            {
                DataObj.OutError("2006");
                return;
            }
            if (baseUsers.Pic.IsNullOrEmpty())//未上传头象
            {
                DataObj.OutError("2041");
                return;
            }
            if (baseUsers.NeekName.IsNullOrEmpty())
            {
                baseUsers.NeekName = baseUsers.TrueName;
                Entity.SaveChanges();
            }

            string wxtoken = GetToken();

            YYDevice YYDevice = Entity.YYDevice.FirstOrDefault(n => n.UId == baseUsers.Id && n.State == 2);//已绑定页面

            if (YYDevice == null)
            {
                //获取设备
                YYDevice = Entity.YYDevice.FirstOrDefault(n => n.UId == 0 && n.State == 1);//未绑定
                if (YYDevice == null)
                {
                    //没有可用的设备
                    YYDevice = GetYYDevice(wxtoken);
                }
                if (YYDevice != null)
                {
                    YYDevice.UId   = baseUsers.Id;
                    YYDevice.State = 2;
                    Entity.SaveChanges();
                }
            }
            if (YYDevice.PageId.IsNullOrEmpty())
            {
                //未绑定页面
                YYPage YYPage = Entity.YYPage.FirstOrDefault(n => n.UId == baseUsers.Id && n.State == 1);
                if (YYPage == null)
                {
                    //生成页面
                    string title       = GetNeekName(baseUsers.NeekName);//从商户名称中获取6位
                    string description = "点击去付款";
                    string URL         = string.Format(SysPath + "/mobile/shop/index-{0}.html", baseUsers.Id, baseUsers.UserName);
                    //string Icon = Utils.ImageUrl("UsersPic", baseUsers.Pic);
                    string Icon                = Utils.ImageUrl("UsersPic", baseUsers.Pic, 120, 120, "Cut");
                    string IconPath            = HttpContext.Current.Server.MapPath(Icon);
                    UploadImageResultJson Img  = WXAPI.UploadImage(wxtoken, IconPath);
                    string            wxpicurl = Img.data.pic_url;
                    AddPageResultJson Page     = WXAPI.AddPage(wxtoken, title, description, URL, wxpicurl);
                    if (Page.errcode == ReturnCode.请求成功)
                    {
                        YYPage          = new YYPage();
                        YYPage.Title    = title;
                        YYPage.UId      = baseUsers.Id;
                        YYPage.SubTitle = description;
                        YYPage.Url      = URL;
                        YYPage.Icon     = Icon;
                        YYPage.WXIcon   = wxpicurl;
                        YYPage.AddTime  = DateTime.Now;
                        YYPage.State    = 1;
                        YYPage.PageId   = Page.data.page_id.ToString();
                        Entity.YYPage.AddObject(YYPage);
                        Entity.SaveChanges();
                    }
                }
                //绑定页面
                long         DevId  = long.Parse(YYDevice.DevId);
                long         PageId = long.Parse(YYPage.PageId);
                WxJsonResult WJR    = WXAPI.BindPage(wxtoken, DevId, PageId);
                if (WJR.errcode == ReturnCode.请求成功)
                {
                    YYDevice.PageId       = YYPage.PageId;
                    baseUsers.YYOpenState = 1;//标识用户已经开通
                    Entity.SaveChanges();
                }
            }

            YYDaily YYDaily = Entity.YYDaily.Where(n => n.UId == baseUsers.Id && n.DevId == YYDevice.DevId && n.OutDate < DateTime.Now).OrderByDescending(n => n.OutDate).FirstOrDefault();

            if (YYDaily == null)
            {
                YYDevice.ClickPV = 0;
                YYDevice.ClickUV = 0;
                YYDevice.ShakePV = 0;
                YYDevice.ShakeUV = 0;
            }
            else
            {
                YYDevice.ClickPV = YYDaily.ClickPV;
                YYDevice.ClickUV = YYDaily.ClickUV;
                YYDevice.ShakePV = YYDaily.ShakePV;
                YYDevice.ShakeUV = YYDaily.ShakeUV;
            }
            DataObj.Data = YYDevice.OutJson();
            DataObj.Code = "0000";
            DataObj.OutString();
        }
예제 #17
0
파일: edit.aspx.cs 프로젝트: zxl881203/src
 /// <summary>
 /// 保存图片 or 语音
 /// </summary>
 /// <param name="Ids">服务器文件ID</param>
 /// <param name="KeyId">ID</param>
 /// <param name="type">img 图片;voice 语音</param>
 private static void saveImgOrVoice(string Ids, string KeyId, string type)
 {
     //Ids = "BdlTq2kWT4JhM_YsLdJIgg_xBhWa3-3ZyCXMBilIFdqNx2Sen2AdDO5QDY2XDCvW";
     // type = "voice";
     if (!string.IsNullOrEmpty(Ids))
     {
         string[]    strImgs  = Ids.Substring(0, Ids.Length - 1).Split(',');
         HttpContext context  = HttpContext.Current;
         string      str1     = HttpContext.Current.Server.MapPath("/");
         string      str3     = KeyId;
         string      str2     = "";//ConfigHelper.Get("JournalVoices");
         string      pathTemp = "";
         string      path     = "";
         if (type == "img")
         {
             str2     = "/UploadFiles/TaskPhotos/";//ConfigHelper.Get("JournalPhotos");
             pathTemp = str1.Substring(0, str1.Length - 1) + str2 + str3 + "\\";
         }
         else if (type == "voice")
         {
             str2     = "/UploadFiles/TaskVoices/";//ConfigHelper.Get("JournalVoices");
             pathTemp = str1.Substring(0, str1.Length - 1) + str2 + str3 + "Temp\\";
             path     = str1.Substring(0, str1.Length - 1) + str2 + str3 + "\\";
             if (!Directory.Exists(path))
             {
                 Directory.CreateDirectory(path);
             }
         }
         if (!Directory.Exists(pathTemp))
         {
             Directory.CreateDirectory(pathTemp);
         }
         foreach (string strID in strImgs)
         {
             //string  str11 = "BdlTq2kWT4JhM_YsLdJIgg_xBhWa3-3ZyCXMBilIFdqNx2Sen2AdDO5QDY2XDCvW";
             string          tagUrl         = "https://qyapi.weixin.qq.com/cgi-bin/media/get?access_token=" + WXAPI.getTokenByAgentId(1000010) + "&media_id=" + strID + "";
             HttpWebResponse response       = HttpWebResponseUtility.CreateGetHttpResponse(tagUrl, null, null, null);
             string          str            = response.Headers.ToString();
             string          strfwqFilename = str.Split('"')[1];//文件名及后缀
             Stream          responseStream = response.GetResponseStream();
             //创建本地文件写入流
             Stream stream = new FileStream(pathTemp + strfwqFilename, FileMode.Create);//保存文件到服务器目录
             byte[] bArr   = new byte[1024];
             int    size   = responseStream.Read(bArr, 0, (int)bArr.Length);
             while (size > 0)
             {
                 stream.Write(bArr, 0, size);
                 size = responseStream.Read(bArr, 0, (int)bArr.Length);
             }
             stream.Close();
             responseStream.Close();
             if (type == "voice")
             {
                 string          paths      = str1.Substring(0, str1.Length - 1).Replace("\\", "/"); // paths = "C:\\ffmpeg.exe";
                 string          pathBefore = pathTemp + strfwqFilename;                             //"D:\\VOICE_001.amr";
                 string          pathLater  = path + strfwqFilename.Split('.')[0] + ".mp3";          //"D:\\VOICE_001.mp3";
                 WavConvertToAmr toamr      = new WavConvertToAmr();
                 toamr.ConvertToMp3(paths, pathBefore, pathLater);
             }
         }
     }
 }
        private YYDevice GetYYDevice(string token, int Times = 0)
        {
            //查询是否有申请未返回状态
            YYApply YYApply = Entity.YYApply.FirstOrDefault(n => n.State == 1);

            if (YYApply == null)
            {
                string Reason = "新加商店设备";
                DeviceApplyResultJson Device = WXAPI.DeviceApply(token, Reason);
                if (Device.errcode == ReturnCode.请求成功)
                {
                    YYApply         = new YYApply();
                    YYApply.AddTime = DateTime.Now;
                    YYApply.Reason  = Reason;
                    YYApply.ApplyId = Device.data.apply_id.ToString();
                    YYApply.Num     = 50;
                    YYApply.State   = 1;
                    if (Device.data.audit_status == 0)
                    {
                        YYApply.State = 0;
                    }
                    Entity.YYApply.AddObject(YYApply);
                    Entity.SaveChanges();
                    if (Device.data.audit_status == 2)
                    {
                        YYApply.State = 2;
                    }
                }
            }
            if (YYApply.State == 1)
            {
                YYApply = GetYYApply(token, YYApply);
            }
            if (YYApply.State == 0)
            {
                if (Times < 5)
                {
                    Thread.Sleep(5000);
                    return(GetYYDevice(token, Times++));
                }
            }
            if (YYApply.State == 2)
            {
                int ApplyId = Int32.Parse(YYApply.ApplyId);
                DeviceSearchResultJson Devices = WXAPI.SearchDeviceByApplyId(token, ApplyId);
                if (Devices.errcode == ReturnCode.请求成功)
                {
                    List <DeviceSearch_Data_Devices> DeviceList = Devices.data.devices;
                    foreach (var p in DeviceList)
                    {
                        var minor    = p.minor.ToString();
                        var savedata = this.Entity.YYDevice.FirstOrDefault(o => o.Minor == minor);
                        if (savedata == null)
                        {
                            //设备入库
                            YYDevice YY = new YYDevice();
                            YY.DevId    = p.device_id.ToString();
                            YY.UUID     = p.uuid;
                            YY.Major    = p.major.ToString();
                            YY.Minor    = p.minor.ToString();
                            YY.UId      = 0;
                            YY.PageId   = string.Empty;
                            YY.AddTime  = DateTime.Now;
                            YY.ActState = 0;
                            YY.State    = 1;
                            Entity.YYDevice.AddObject(YY);
                        }
                    }
                    Entity.SaveChanges();
                }
            }
            YYDevice YYDevice = Entity.YYDevice.FirstOrDefault(n => n.UId == 0 && n.State == 1);

            return(YYDevice);
        }
예제 #19
0
    public void saveData(int ii)
    {
        OAJournal model = this.GetModel(ii);

        if (this.action == "add")
        {
            this.pcSer.Add(model);
            saveRY(model.Id);
        }
        else if (this.action == "edit")
        {
            this.pcSer.Update(model);
            publicDbOpClass.ExecSqlString("DELETE from OA_Journal_Append where journal_id='" + model.Id + "'");
            saveRY(model.Id);
        }
        if (ii == 1)
        {
            string strSYR  = hfldTo.Value.ToString();     //审阅人
            string strXGRS = hfldCopyto.Value.ToString(); //相关人
            //发送微信消息
            WXAPI.sendWeChatMsg(UserCode.ToString(), strSYR, strXGRS, "log", model.Id.ToString(), model.title.ToString(), model.create_date.ToString());
            //string strUsers = "";
            //if (!string.IsNullOrEmpty(strSYR))
            //{
            //    strUsers += "'" + strSYR + "'";
            //}
            //if (!string.IsNullOrEmpty(strXGRS))
            //{
            //    string[] strXGR = strXGRS.Split(',');
            //    strUsers += "," + "'" + strXGRS + "'";
            //    //strUsers += "|"+ strXGRS.Replace(',','|');
            //}
            //string strSQL1 = "select * from PT_yhmc where v_yhdm ='" + base.UserCode + "'";
            //DataTable dt1 = publicDbOpClass.DataTableQuary(strSQL1);
            //string strSQL = "select * from PT_yhmc where v_yhdm in(" + strUsers + ")";
            //DataTable dt = publicDbOpClass.DataTableQuary(strSQL);
            ////string wxUsers = "";
            //if (dt.Rows.Count > 0)
            //{
            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        //    wxUsers += dr["WXID"] + "|";
            //        //}
            //        //string str0 = "";//"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx251384a873c4d422&redirect_uri=";
            //        string str1 = new BasicConfigService().GetValue("domain");
            //        string str2 = "/WeChat/log/show.html?id=" + model.Id + "&userType=tj&userID="+ dr["v_yhdm"];
            //        // string str3 = "";//"&action=add&response_type=code&scope=snsapi_base#wechat_redirect";

            //        // string str4 = System.Web.HttpUtility.UrlEncode(str1 + str2);//System.Web.HttpUtility.UrlDecode("");
            //        // string str4 = str1 + str2;
            //        //string strURL = str0 + str4 + str3;

            //        //WXAPI.sendText(1000008, "您有新的工作日志待查阅\n" + model.title.ToString() + model.start_time.ToString() + "\n", strURL, wxUsers.Substring(0, wxUsers.Length - 1));
            //        //WXAPI.sendText(1000008, "您有新的工作日志待查阅\n<h2><b>" + model.title.ToString() + "</b></h2>[填写人:" + dt1.Rows[0]["v_xm"].ToString() + "]\n", strURL, dr["WXID"].ToString());
            //        //string description = "< div class=\"gray\">[填写人:" + dt1.Rows[0]["v_xm"].ToString() + "] " + model.create_date.ToString() + "</div> <div class=\"normal\">"+ model.content.ToString()+ "</div><div class=\"highlight\">请于2016年10月10日前联系行政同事领取</div>";
            //        string strURL = str1 + str2;
            //        string strTitle = "您有新的工作日志待查阅";
            //        string description = "<div class=\\\"highlight\\\">" + model.title.ToString() + "</div><div class=\\\"gray\\\">[填写人:" + dt1.Rows[0]["v_xm"].ToString() + "] " + model.create_date.ToString() + "</div>";
            //        string btntxt = "点击查看";
            //        WXAPI.sendTextCard(strTitle, 1000008, description, strURL, dr["WXID"].ToString(), btntxt);
            //    }
            // }
        }
        base.RegisterScript("top.ui.tabSuccess({parentName:'_Journal'});");
    }
예제 #20
0
    //同步部门到微信 (添加或更新)
    //protected void btnTBtoWX_Click(object sender, EventArgs e)
    //{

    //    DataTable dt = this.hrAction.GetDepartment();
    //    if (dt.Rows.Count > 0)
    //    {
    //        foreach (DataRow dataRow in dt.Rows)
    //        {
    //            try
    //            {
    //                string strResult = WXAPI.createWXdpt(dataRow);
    //            }
    //            catch {
    //                string strResult = WXAPI.updateWXdpt(dataRow);
    //            }
    //        }
    //    }
    //}
    //同步部门(微信->本地)
    protected void btnFromWX_Click(object sender, EventArgs e)
    {
        string str = WXAPI.getWXdpt();
    }
예제 #21
0
    //保存评论
    protected void btnSave_Click(object sender, EventArgs e)
    {
        //保存评论
        OAJournalComment model3 = this.GetModel();

        this.pcSer4.Add(model3);

        //保存评论@的人
        OAJournalAppend model2  = new OAJournalAppend();
        string          strXGRS = hfldCopyto.Value.ToString();//评论@相关人

        if (!string.IsNullOrEmpty(strXGRS))
        {
            string   strUsers = "";
            string[] strXGR   = strXGRS.Split(',');
            foreach (string str in strXGR)
            {
                strUsers += "'" + str + "'" + ",";
                DataTable dt = pcSer2.resulet(str, Id);
                if (dt.Rows.Count > 0)
                {
                }
                else
                {
                    model2.Id         = Guid.NewGuid().ToString(); //主键
                    model2.journal_id = Id;                        //日志ID
                    model2.user_id    = str;                       //审阅人ID
                    model2.user_type  = 1;                         // 3 提交人、0 审阅人、1相关人、2审阅及相关人;
                    this.pcSer2.Add(model2);
                }
            }
            //发送微信消息
            WXAPI.sendWeChatMsg(UserCode.ToString(), "", strXGRS, "logPL", this.Id, title.Text.ToString(), create_date.Text.ToString());
            //string strSQL = "select * from PT_yhmc where v_yhdm in(" + strUsers.Substring(0, strUsers.Length-1) + ")";
            //DataTable dt2 = publicDbOpClass.DataTableQuary(strSQL);
            ////string wxUsers = "";
            //if (dt2.Rows.Count > 0)
            //{
            //    foreach (DataRow dr in dt2.Rows)
            //    {
            //        //    wxUsers += dr["WXID"] + "|";
            //        //}
            //        //string str0 = "";//"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx251384a873c4d422&redirect_uri=";
            //        string str1 = new BasicConfigService().GetValue("domain");
            //        string str2 = "/WeChat/log/show.html?id=" + this.KeyId.Value.ToString() + "&userType=tj&userID="+ dr["v_yhdm"];
            //        //string str3 = "";//"&action=add&response_type=code&scope=snsapi_base#wechat_redirect";
            //        string str4 = System.Web.HttpUtility.UrlEncode(str1 + str2);//System.Web.HttpUtility.UrlDecode("");
            //                                                                    // string strURL = str0 + str4 + str3;
            //                                                                    // //WXAPI.sendText(1000008, "有新的工作日志评论@您\n" + title.Text.ToString() + "\n", strURL, wxUsers.Substring(0, wxUsers.Length - 1));
            //                                                                    //WXAPI.sendText(1000008, "有新的工作日志评论@您\n<h2><b>" + title.Text.ToString() + "</b></h2>[填写人:"+ creater.Text.ToString() + "]\n", strURL, dr["WXID"].ToString());

            //        // string strTitle = "有新的工作日志评论@您";
            //        // string description = "<div class=\\\"highlight\\\">" + title.Text.ToString() + "</div><div class=\\\"gray\\\">[填写人:" + creater.Text.ToString() + "] " + this.create_date.Text.ToString() + "</div>";
            //        // string btntxt = "点击查看";
            //        // WXAPI.sendTextCard(strTitle, 1000008, description, strURL, dr["WXID"].ToString(), btntxt);
            //        string strSQL1 = "select * from PT_yhmc where v_yhdm ='" + dr["v_yhdm"] + "'";
            //        DataTable dt1 = publicDbOpClass.DataTableQuary(strSQL1);
            //        string strURL = str1 + str2;
            //        string strTitle = "有新的工作日志评论@您";
            //        string description = "<div class=\\\"highlight\\\">" + title.Text.ToString() + "</div><div class=\\\"gray\\\">[评论人:" + dt1.Rows[0]["v_xm"].ToString() + "] " + DateTime.Now.ToShortDateString()+ "</div>";
            //        string btntxt = "点击查看";
            //        WXAPI.sendTextCard(strTitle, 1000008, description, strURL, dr["WXID"].ToString(), btntxt);
            //    }
            //}
        }
        base.RegisterScriptRefresh();
    }
        public void Post()
        {
            string Data = DataObj.GetData();

            if (Data.IsNullOrEmpty())
            {
                DataObj.OutError("1000");
                return;
            }
            JObject json = new JObject();

            try
            {
                json = (JObject)JsonConvert.DeserializeObject(Data);
            }
            catch (Exception Ex)
            {
                Log.Write("[ZhouBianUpdate]:", "【Data】" + Data, Ex);
            }
            if (json == null)
            {
                DataObj.OutError("1000");
                return;
            }
            //JObject pp = (JObject)p;
            Users Users = new Users();

            Users = JsonToObject.ConvertJsonToModel(Users, json);
            Users baseUsers = Entity.Users.FirstOrDefault(n => n.Token == Users.Token);

            if (baseUsers == null)//用户令牌不存在
            {
                DataObj.OutError("2004");
                return;
            }
            if (baseUsers.State != 1)//用户被锁定
            {
                DataObj.OutError("2003");
                return;
            }
            if (baseUsers.CardStae != 2)//未实名认证
            {
                DataObj.OutError("2006");
                return;
            }
            if (baseUsers.Pic.IsNullOrEmpty())//未上传头象
            {
                DataObj.OutError("2041");
                return;
            }

            string wxtoken = GetToken();

            YYDevice YYDevice = Entity.YYDevice.FirstOrDefault(n => n.UId == baseUsers.Id && n.State == 2);//已绑定页面
            YYPage   YYPage   = Entity.YYPage.FirstOrDefault(n => n.UId == baseUsers.Id && n.State == 1);

            string title       = GetNeekName(baseUsers.NeekName);//从商户名称中获取6位
            string description = "点击去付款";
            string URL         = string.Format(SysPath + "/mobile/shop/index-{0}.html", baseUsers.Id, baseUsers.UserName);
            string Icon        = Utils.ImageUrl("UsersPic", baseUsers.Pic, 120, 120, "Cut");

            if (Icon != YYPage.Icon || title != YYPage.Title)
            {
                string wxpicurl = YYPage.WXIcon;
                if (Icon != YYPage.Icon)//修改了头象则需要重新上传头象
                {
                    string IconPath           = HttpContext.Current.Server.MapPath(Icon);
                    UploadImageResultJson Img = WXAPI.UploadImage(wxtoken, IconPath);
                    wxpicurl = Img.data.pic_url;
                    long page_id = Int64.Parse(YYPage.PageId);
                    UpdatePageResultJson Page = WXAPI.EditPage(wxtoken, page_id, title, description, URL, wxpicurl);
                    if (Page.errcode == ReturnCode.请求成功)
                    {
                        YYPage.Title  = title;
                        YYPage.Icon   = Icon;
                        YYPage.WXIcon = wxpicurl;
                        Entity.SaveChanges();
                    }
                }
            }
            DataObj.Data = "";
            DataObj.Code = "0000";
            DataObj.OutString();
        }
예제 #23
0
파일: edit.aspx.cs 프로젝트: zxl881203/src
    /// <summary>
    /// 保存页面数据
    /// </summary>
    /// <param name="status">0草稿、1未开始、2执行中、3已完成、4已关闭、5已删除  </param>
    public void saveData(int status)
    {
        string strSql  = "";
        string strSql1 = "";

        if (this.action == "add")
        {
            strSql = string.Format(@"
            INSERT INTO [OA_Task]
           ([id]
           ,[type_id]
           ,[title]
           ,[content]
           ,[creater_id]
           ,[create_time]
           ,[status]
           ,[start_time]
           ,[end_time]
           --,[complete_time]
           ,[priority_id]
           ,if_send
)
     VALUES
           ('{0}'--<id, varchar(50),>
           ,'{1}'--<type_id, varchar(50),>
           ,'{2}'--<title, nvarchar(50),>
           ,'{3}'--<content, text,>
           ,'{4}'--<creater_id, varchar(50),>
           ,'{5}'--<create_time, datetime,>
           ,{6}--<status, int,>
           ,'{7}'--<start_time, datetime,>
           ,'{8}'--<end_time, datetime,>
          --,[complete_time] = '{9}'--<complete_time, datetime,>
           ,'{9}'--<priority_id, varchar(50),>
            ,{10}--<if_send, int,>
		   )"        , this.KeyId.Value, type_id.SelectedValue, title.Value.ToString(), content.Value.ToString(),
                                   UserID.Value, DateTime.Now, status, start_time.Value.ToString(), end_time.Value.ToString(), priority_id.Text.ToString(), if_send.SelectedValue.ToString());

            strSql1 = @"INSERT INTO [OA_Task_Append]
           ([id]
           ,[task_id]
           ,[user_id]
           --,[look_time]
           --,[progress]
           --,[remark]
           ,[user_type]
           ,[up_time]
		   )
     VALUES" + RYinfo(this.KeyId.Value);
        }
        else if (this.action == "edit")
        {
            strSql = string.Format(@"
       UPDATE [OA_Task]
       SET --[id] = <id, varchar(50),>
      --,
	   [type_id] ='{1}'-- <type_id, varchar(50),>
      ,[title] = '{2}'--<title, nvarchar(50),>
      ,[content] = '{3}'--<content, text,>
      ,[creater_id] ='{4}'-- <creater_id, varchar(50),>
      ,[create_time] ='{5}'-- <create_time, datetime,>
      ,[status] = '{6}'--<status, int,>
      ,[start_time] = '{7}'--<start_time, datetime,>
      ,[end_time] = '{8}'--<end_time, datetime,>
       --,[complete_time] = '{9}'--<complete_time, datetime,>
      ,[priority_id] = '{9}'--<priority_id, varchar(50),>
      ,if_send= '{10}'--<if_send, int,>
 WHERE [id]= '{0}'", this.KeyId.Value, type_id.SelectedValue, title.Value.ToString(), content.Value.ToString(),
                                   UserID.Value, DateTime.Now, status, start_time.Value.ToString(), end_time.Value.ToString(), priority_id.Text.ToString(), if_send.SelectedValue.ToString());
            strSql1 = "DELETE from OA_Task_Append where task_id='" + this.KeyId.Value + "';" + @"INSERT INTO [OA_Task_Append]
           ([id]
           ,[task_id]
           ,[user_id]
           --,[look_time]
           --,[progress]
           --,[remark]
           ,[user_type]
           ,[up_time]
		   )
     VALUES" + RYinfo(this.KeyId.Value);
        }
        using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString))
        {
            sqlConnection.Open();
            SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
            try
            {
                SqlHelper.ExecuteNonQuery(sqlTransaction, CommandType.Text, strSql);
                SqlHelper.ExecuteNonQuery(sqlTransaction, CommandType.Text, strSql1);

                #region 保存 图片及音频
                string imgIds   = imgId.Value.ToString();
                string voiceIds = voiceId.Value.ToString();
                if (action == "add")
                {
                    //pcSer.Add(model);
                    //saveRY(id, syr, xgr);
                    if (!string.IsNullOrEmpty(imgIds))
                    {
                        saveImgOrVoice(imgIds, this.KeyId.Value, "img");
                    }
                    if (!string.IsNullOrEmpty(voiceIds))
                    {
                        saveImgOrVoice(voiceIds, this.KeyId.Value, "voice");
                    }
                }
                else if (action == "edit")
                {
                    //pcSer.Update(model);
                    //publicDbOpClass.ExecSqlString("DELETE from OA_Journal_Append where journal_id='" + model.Id + "'");
                    //saveRY(id, syr, xgr);
                    if (!string.IsNullOrEmpty(imgIds))
                    {
                        saveImgOrVoice(imgIds, this.KeyId.Value, "img");
                    }
                    if (!string.IsNullOrEmpty(voiceIds))
                    {
                        saveImgOrVoice(voiceIds, this.KeyId.Value, "voice");
                    }
                }
                #endregion 保存 图片及音频

                if (status != 0)
                {
                    //给执行人、相关人 发送微信消息
                    WXAPI.sendWeChatMsg(this.UserID.Value.ToString(), hfldTo.Value.ToString(), hfldCopyto.Value.ToString(), "task", this.KeyId.Value, title.Value.ToString(), DateTime.Now.ToString());
                }
                sqlTransaction.Commit();
                if (status == 0)
                {
                    RegisterScript("alert('系统提示:\\n\\操作成功!'); location='list.aspx?status=0&userType=cg&userID=" + UserID.Value.ToString() + "'");
                }
                else
                {
                    RegisterScript("alert('系统提示:\\n\\操作成功!'); location='list.aspx?status=" + status + "&userType=tj&userID=" + UserID.Value.ToString() + "'");
                }
            }
            catch
            {
                sqlTransaction.Rollback();
                RegisterScript("alert('系统提示:\\n\\操作失败!');");
            }
        }
    }
예제 #24
0
    protected void BtnAdd_Click(object sender, System.EventArgs e)
    {
        if (this.ddltTemplate.SelectedValue == "-1")
        {
            base.RegisterScript("top.ui.alert('请选择流程模板')");
            return;
        }
        WFInstanceMainService wFInstanceMainService = new WFInstanceMainService();
        WFTemplateNodeService wFTemplateNodeService = new WFTemplateNodeService();

        if (wFTemplateNodeService.GetNodes(this.TemplateID).Count == 0)
        {
            wFInstanceMainService.UpdateBusinessData(this.RecordID.ToString(), this.BusinessCode, 1);
            WFBusinessCodeService wFBusinessCodeService = new WFBusinessCodeService();
            WFBusinessCode        byId = wFBusinessCodeService.GetById(this.BusinessCode);
            string path     = base.Server.MapPath("~/SelfEventInfo.xml");
            string typeName = SelfEventAction.GetTypeName(path, byId.LinkTable, byId.StateField);
            if (!string.IsNullOrEmpty(typeName))
            {
                ISelfEvent selfEvent = (ISelfEvent)System.Reflection.Assembly.Load("PmBusinessLogic").CreateInstance(typeName);
                if (selfEvent != null)
                {
                    System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(selfEvent.CommitEvent), this.RecordID.ToString());
                }
            }
            if (this.BusinessCode == "089")
            {
                PTPrjInfoZTB byId2 = this.ptInfoZTbSer.GetById(this.RecordID);
                this.ptInfoZTbSer.UpdatePrjState(byId2, new int?(2));
            }
            else
            {
                if (this.BusinessCode == "100")
                {
                    PrjMember.AddLimit(this.RecordID);
                }
                else
                {
                    if (this.BusinessCode == "107")
                    {
                        Progress.UpdateLatest(this.RecordID.ToString());
                    }
                    else
                    {
                        if (this.BusinessCode == "108")
                        {
                            cn.justwin.BLL.ProgressManagement.Version.UpdateLatest(this.RecordID.ToString());
                        }
                    }
                }
            }
            base.RegisterScript("top.ui.winSuccess({parentName: '_StartWf'}); top.ui.show('审核通过'); ");
            return;
        }
        if (wFInstanceMainService.IsReSubmit(this.RecordID.ToString(), this.BusinessCode))
        {
            this.Page.ClientScript.RegisterStartupScript(base.GetType(), "", "top.ui.alert('当前数据已经被提交,禁止二次提交');", true);
            return;
        }
        if (this.ddltTemplate.SelectedValue != "-1")
        {
            FlowChartAction.display_FlowChart(this.tbFlowChart, this.TemplateID);
            if (this.txtReceiver.Text != "")
            {
                if (this.TemplateID == 0)
                {
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "", "top.ui.alert('请选择流程模板');", true);
                    return;
                }
                string[] array = new string[3];
                this.TemplateID = System.Convert.ToInt32(this.hdnTemplateID.Value);
                if (this.TemplateCount > 1)
                {
                    array = FlowAuditAction.GetOffsetNodeFirst(this.TemplateID, this.BusinessClass, this.RecordID);
                    this.hdnNodeId.Value      = array[0].ToString();
                    this.hdnOrderNumber.Value = array[1].ToString();
                }
                else
                {
                    if (this.TemplateCount == 1)
                    {
                        if (this.OffsetCount > 1)
                        {
                            this.hdnNodeId.Value      = this.NodeID.ToString();
                            this.hdnOrderNumber.Value = "1";
                        }
                        else
                        {
                            array = FlowAuditAction.GetOffsetNodeFirst(this.TemplateID, this.BusinessClass, this.RecordID);
                            this.hdnNodeId.Value      = array[0].ToString();
                            this.hdnOrderNumber.Value = array[1].ToString();
                        }
                    }
                }
                int offsetorder = System.Convert.ToInt32(this.hdnOrderNumber.Value.ToString().Trim());
                this.NodeID = System.Convert.ToInt32(this.hdnNodeId.Value.ToString().Trim());
                if (this.hdnNodeId.Value.Trim() == "0")
                {
                    this.JS.Text = "top.ui.alert('工作流程多分支模板未设置分支条件!');";
                    return;
                }
                if (this.Type.Value != "")
                {
                    FlowAuditAction.UpdateNode(this.hdnReceiver.Value, this.TemplateID);
                }
                if (FlowAuditAction.BeginFlow(this.BusinessClass, this.BusinessCode, this.RecordID, this.TemplateID, this.NodeID, offsetorder, this.ProjectCode, this.UserCode))
                {
                    try
                    {
                        BasicConfigService basicConfigService = new BasicConfigService();

                        string WXTX = basicConfigService.GetValue("WXTX");//是否微信提醒
                        if (WXTX == "1")
                        {
                            DataTable dataTable  = publicDbOpClass.DataTableQuary("select * from wf_templatenode where templateid=" + this.TemplateID + " and frontnode=0");
                            DataTable dataTable2 = publicDbOpClass.DataTableQuary(string.Concat(new string[]
                            {
                                "select businessclassname from wf_business_class where businesscode='",
                                this.BusinessCode,
                                "' and businessclass='",
                                this.BusinessClass,
                                "'"
                            }));
                            if (dataTable.Rows.Count > 0)
                            {
                                string text2 = dataTable.Rows[0]["Operater"].ToString();
                                string text  = dataTable2.Rows[0][0].ToString();
                                //给执行人、相关人 发送微信消息
                                //WXAPI.sendWeChatMsg(this.UserID.Value.ToString(), hfldTo.Value.ToString(), hfldCopyto.Value.ToString(), "task", this.KeyId.Value, title.Value.ToString(), DateTime.Now.ToString());
                                WXAPI.sendWeChatMsg(this.UserCode, text2, "", "wf", "", text, DateTime.Now.ToString());
                            }
                        }

                        //
                        //if (ConfigHelper.Get("SMS") != "")
                        //{
                        //	DataTable dataTable = publicDbOpClass.DataTableQuary("select * from wf_templatenode where templateid=" + this.TemplateID + " and frontnode=0");
                        //	DataTable dataTable2 = publicDbOpClass.DataTableQuary(string.Concat(new string[]
                        //	{
                        //		"select businessclassname from wf_business_class where businesscode='",
                        //		this.BusinessCode,
                        //		"' and businessclass='",
                        //		this.BusinessClass,
                        //		"'"
                        //	}));
                        //	if (dataTable.Rows.Count > 0)
                        //	{
                        //		string text = dataTable2.Rows[0][0].ToString();
                        //		if (dataTable.Rows[0]["isselreceiver"].ToString() == "1")
                        //		{
                        //			SMS sMS = new SMS();
                        //			string mbNo = new PhoozyanHelpAction().RePhoneCode(this.hdnReceiver.Value);
                        //			string msg = string.Concat(new string[]
                        //			{
                        //				"公司短信:",
                        //				this.txtReceiver.Text,
                        //				"您好!",
                        //				new CommunicationAction().BackUserName(this.UserCode),
                        //				"已发起",
                        //				text,
                        //				"流程,请您查看审核!"
                        //			});
                        //			if (!(bool)sMS.Send("", mbNo, msg, "", "", "")[0])
                        //			{
                        //			}
                        //		}
                        //		else
                        //		{
                        //			string arg = "";
                        //			System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
                        //			System.Collections.ArrayList arrayList2 = new System.Collections.ArrayList();
                        //			string text2 = dataTable.Rows[0]["Operater"].ToString();
                        //			if (text2.Contains(","))
                        //			{
                        //				string[] array2 = text2.Split(new char[]
                        //				{
                        //					','
                        //				});
                        //				for (int i = 0; i < array2.Length - 1; i++)
                        //				{
                        //					new userManageDb().GetUserName(array2[i]);
                        //					arrayList.Add(arrayList);
                        //					string value = new PhoozyanHelpAction().RePhoneCode(array2[i]);
                        //					arrayList2.Add(value);
                        //				}
                        //				for (int j = 0; j < arrayList.Count; j++)
                        //				{
                        //					if (!string.IsNullOrEmpty(arrayList2[j].ToString()))
                        //					{
                        //						string msg2 = string.Concat(new object[]
                        //						{
                        //							"公司短信:",
                        //							arrayList[j],
                        //							"您好!",
                        //							new CommunicationAction().BackUserName(this.UserCode),
                        //							"已发起",
                        //							text,
                        //							"流程,请您查看审核!"
                        //						});
                        //						SMS sMS2 = new SMS();
                        //						if (!(bool)sMS2.Send("", arrayList2[j].ToString(), msg2, "", "", "")[0])
                        //						{
                        //							arg += arrayList[j];
                        //						}
                        //					}
                        //					else
                        //					{
                        //						arg = arg + arrayList[j] + " ";
                        //					}
                        //				}
                        //			}
                        //			else
                        //			{
                        //				string text3 = new CommunicationAction().BackUserName(dataTable.Rows[0][0].ToString());
                        //				DataTable dataTable3 = publicDbOpClass.DataTableQuary("select mobilephonecode from pt_yhmc where v_yhdm='" + dataTable.Rows[0]["Operater"].ToString() + "'");
                        //				if (dataTable3.Rows.Count > 0)
                        //				{
                        //					string mbNo2 = dataTable3.Rows[0][0].ToString();
                        //					if (dataTable2.Rows.Count > 0)
                        //					{
                        //						string msg3 = string.Concat(new string[]
                        //						{
                        //							"公司短信:",
                        //							text3,
                        //							"您好!",
                        //							new CommunicationAction().BackUserName(this.UserCode),
                        //							"已发起",
                        //							text,
                        //							"流程,请您查看审核!"
                        //						});
                        //						SMS sMS3 = new SMS();
                        //						bool arg_85F_0 = (bool)sMS3.Send("", mbNo2, msg3, "", "", "")[0];
                        //					}
                        //				}
                        //			}
                        //		}
                        //	}
                        //}
                    }
                    catch
                    {
                    }
                    if (!string.IsNullOrEmpty(base.Request["purl"]))
                    {
                        base.RegisterScript("top.ui.winSuccess({parentName: '_StartWf'}); top.ui.show('工作流程已成功启动'); ");
                        return;
                    }
                    base.RegisterScript("top.ui.winSuccess({parentName: '_StartWf'}); top.ui.show('工作流程已成功启动'); ");
                    return;
                }
                else
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), "myalert", "<script type='text/javascript'>alert('请找管理员设置 " + this.ddltTemplate.SelectedItem.Text.ToString() + " 流程的负责人。')</script>", false);
                }
            }
        }
    }