示例#1
0
        //测试推送
        protected void btn_test_Click(object sender, EventArgs e)
        {
            //将图片保存至本地服务器
            if (hidden_field.Value != null)
            {
                string access_token = VerifyLegal.GetAccess_Token();
                GetMultimedia(access_token, hidden_field.Value);
            }

            //string num = "";
            //WX2HK.ReturnInfo.messagePushByNum(num, "良辰在此", "", "你们这些渣渣~!", "");
        }
示例#2
0
        //插入附件信息
        private void InsertFiles(string definedName)
        {
            string access_token = VerifyLegal.GetAccess_Token();//获取access_token

            string sqlCmd   = "";
            string fileList = hidden_field.Value;

            //解析明细Id
            String[] str = fileList.Split(';');

            int sortIndex = 0;//文件名后缀

            foreach (string it in str)
            {
                if (it == "")
                {
                    break;
                }
                sortIndex = sortIndex + 1;

                string fileName = GetMultimedia(access_token, it, "/upload");
                sqlCmd  = "insert into OA_DocMgmt_DocList (docName,docTyp,docStat,subman,subDte,doc_leng,docPath) values ";
                sqlCmd += "('" + definedName + "-" + sortIndex.ToString() + "','" + ddl_docType.SelectedValue + "',1,'" + curUserId + "','" + DateTime.Now + "',";
                sqlCmd += "'" + ddl_proj.SelectedValue + "','" + fileName + "')";
                int exeCount = SqlSel.ExeSql(sqlCmd);
                if (exeCount == 0)
                {
                    Alert.ShowInTop("上传出错!");
                    return;
                }
                else
                {
                    //插入其他文件信息
                    sqlCmd = "select max(id) from OA_DocMgmt_DocList";
                    int docId = Convert.ToInt32(SqlSel.GetSqlScale(sqlCmd));
                    sqlCmd  = "insert into OA_DocMgmt_Propety (docId,docSN,AgreementPaty,SubjectMatter,AgreeAmount,AmountType,StartDate,EndDate,Remarks) values ";
                    sqlCmd += "('" + docId + "','" + txb_docSN.Text + "','" + txa_AgreementPaty.Text + "','" + txa_SubjectMatter.Text + "','" + numb_amount.Text + "',";
                    sqlCmd += "'" + txb_AmountType.Text + "','" + DatePicker1.Text + "','" + DatePicker2.Text + "','" + txa_Remarks.Text + "')";
                    SqlSel.ExeSql(sqlCmd);
                }
            }

            Alert.Show("文件全部上传成功!");
            //表单重置
            SimpleForm1.Reset();
        }
示例#3
0
        protected void btn_synCorpToWx_Click(object sender, EventArgs e)
        {
            DataTable wxUserDt = new DataTable();
            string    deptId   = System.Configuration.ConfigurationManager.AppSettings["CorpDeptId"]; //指定企业号通讯录部门Id

            wxUserDt = selectUser.getDeptUserList(deptId);                                            //得到企业号中的所有人员信息
            string    sqlCmd     = "select * from OA_Sys_EmployeeInfo where useStatus='1'";
            DataTable corpUserDt = new DataTable();

            SqlSel.GetSqlSel(ref corpUserDt, sqlCmd);//获取企业信息中所有在职人员
            for (int i = 0; i < corpUserDt.Rows.Count; i++)
            {
                string    userId = corpUserDt.Rows[i]["id"].ToString();
                DataRow[] drArr  = wxUserDt.Select("userid='" + userId + "'");
                //如果成员不存在,则创建
                if (drArr.Length == 0)
                {
                    VerifyLegal.createUser(corpUserDt.Rows[i]["id"].ToString(), corpUserDt.Rows[i]["chineseName"].ToString(), deptId, corpUserDt.Rows[i]["phoneNumber"].ToString());
                }
                else //存在则更新信息
                {
                    VerifyLegal.updateUser(corpUserDt.Rows[i]["id"].ToString(), corpUserDt.Rows[i]["chineseName"].ToString(), deptId, corpUserDt.Rows[i]["phoneNumber"].ToString());
                }
            }

            //删除离职人员信息
            sqlCmd = "select * from OA_Sys_EmployeeInfo where useStatus='0'";
            DataTable leaveUserDt = new DataTable();

            SqlSel.GetSqlSel(ref leaveUserDt, sqlCmd);
            List <string> userList = new List <string>();

            for (int i = 0; i < leaveUserDt.Rows.Count; i++)
            {
                userList.Add(leaveUserDt.Rows[i]["id"].ToString());
            }

            VerifyLegal.deleteUser(userList);

            Alert.ShowInTop("同步成功!");
        }
示例#4
0
        //插入附件信息
        private void InsertFiles(string formId)
        {
            string access_token = VerifyLegal.GetAccess_Token();//获取access_token

            string sqlCmd   = "";
            string fileList = hidden_field.Value;

            //解析明细Id
            String[] str = fileList.Split(';');
            foreach (string it in str)
            {
                if (it == "")
                {
                    break;
                }

                string fileName = GetMultimedia(access_token, it);
                sqlCmd = "insert into OA_Sys_files (FormId,fileName,formDataName) values ('" + formId + "','" + fileName + "','OA_Fines_Main')";
                SqlSel.ExeSql(sqlCmd);
            }
        }
示例#5
0
 protected void btn_downLoad_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(fileName))
         {
             MediaType  mt         = MediaType.file;                             //file型多媒体文件
             string     filePath   = Server.MapPath("/image") + "\\" + fileName; //上传文件路径
             string     token      = VerifyLegal.GetAccess_Token();
             UpLoadInfo uploadFile = WxUpLoad(filePath, token, mt);              //上传临时多媒体文件,返回mediaId
             if (uploadFile != null)
             {
                 string mediaId = uploadFile.media_id;
                 ReturnInfo.pushMessage_File(curUserId, System.Configuration.ConfigurationManager.AppSettings["CorpAppId"], mediaId);//向指定用户发送file型消息
                 btn_downLoad.Hidden = true;
                 label_result.Hidden = false;
                 label_result.Text   = "文件下载完成!";
             }
             else
             {
                 btn_downLoad.Hidden = true;
                 label_result.Hidden = false;
                 label_result.Text   = "文件下载失败!";
                 return;
             }
         }
         else
         {
             Alert.ShowInTop("文件丢失,请重试!");
             return;
         }
     }
     catch (Exception ex)
     {
         Alert.ShowInTop(ex.Message);
     }
 }
示例#6
0
 //
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         //限当月提交
         //int curMonth = DateTime.Now.Month;
         //int subMonth = Convert.ToDateTime(DatePicker1.Text).Month;
         //if (subMonth != curMonth)
         //{
         //    Alert.ShowInTop("请假申请仅限当月提交");
         //    return;
         //}
         //补充说明不可超出数据库字段长度限制
         if (TextArea_desc.Text.Length > 500)
         {
             Alert.ShowInTop("补充说明字符超限!");
             return;
         }
         string  date1 = DatePicker1.Text + " " + TimePicker1.Text;
         string  date2 = DatePicker2.Text + " " + TimePicker2.Text;
         decimal days, hours;
         string  localImg = "";
         //请假天数
         if (string.IsNullOrEmpty(numbbox_days.Text))
         {
             days = 0;
         }
         else
         {
             days = Convert.ToDecimal(numbbox_days.Text);
         }
         //请假时间
         if (string.IsNullOrEmpty(numbbox_hours.Text))
         {
             hours = 0;
         }
         else
         {
             hours = Convert.ToDecimal(numbbox_hours.Text);
         }
         //将图片保存至本地服务器
         if (!string.IsNullOrEmpty(hidden_field.Value))
         {
             string access_token = VerifyLegal.GetAccess_Token();
             localImg = GetMultimedia(access_token, hidden_field.Value);
         }
         string sqlCmd = "insert into T_LeaveReq (Typ,ReqMan,ReqDte,LeaveReason,LeaveDt1,LeaveDt2,Stat,Days,Hours,AddFunc,wxImgServId,localImgUrl) values ";
         sqlCmd += "('" + RadioButtonList_goal.SelectedValue + "','" + workNo + "','" + DateTime.Now + "','" + TextArea_desc.Text + "','" + date1 + "','" + date2 + "',0,";
         sqlCmd += "'" + days + "','" + hours + "',3,'" + hidden_field.Value + "','" + localImg + "')";
         if (SqlSel.ExeSql(sqlCmd) == 0)
         {
             Alert.ShowInTop(sqlCmd, "执行出错!");
             return;
         }
         else
         {
             sqlCmd = "select max(Id) from T_LeaveReq where reqman='" + workNo + "'";
             int mainId = Convert.ToInt32(SqlSel.GetSqlScale(sqlCmd));
             sqlCmd = "insert into Rs_QjAndJb_Subdtl (yhbh,Typ,MainId) values ('" + workNo + "','2'," + mainId + ")";
             SqlSel.ExeSql(sqlCmd);
             //插入审批表
             sqlCmd = "select parent_Gh from View_Rs_employeeinfo where Gh_id = '" + workNo + "'";
             if (string.IsNullOrEmpty(SqlSel.GetSqlScale(sqlCmd).ToString()))
             {
                 sqlCmd = "update T_LeaveReq set stat=-1 where id=" + mainId;
                 SqlSel.ExeSql(sqlCmd);
                 Alert.ShowInTop("您的直属上级没有设置,无法填写请假申请,请联系人事部门。");
                 return;
             }
             String spMan = SqlSel.GetSqlScale(sqlCmd).ToString();
             sqlCmd = "insert into T_SpFollow (spTyp,tabId,WorkNo,Checked,Sort) values ('2'," + mainId + ",'" + spMan + "','0','1')";
             SqlSel.ExeSql(sqlCmd);
             //超过5天的请假多层审批
             //if (days > 5)
             //{
             //    sqlCmd = "select parent_Gh from View_Rs_employeeinfo where Gh_id = '" + spMan + "'";
             //    if (string.IsNullOrEmpty(SqlSel.GetSqlScale(sqlCmd).ToString()))
             //    {
             //        //无上上级领导直接跳过
             //    }
             //    else
             //    {
             //        String spMan2 = SqlSel.GetSqlScale(sqlCmd).ToString();
             //        sqlCmd = "insert into T_SpFollow (spTyp,tabId,WorkNo,Checked,Sort) values ('2'," + mainId + ",'" + spMan2 + "','0','2')";
             //        SqlSel.ExeSql(sqlCmd);
             //    }
             //}
             //向对象推送相关消息
             sqlCmd = "select CellPhone from x_user where name='" + spMan + "'";
             string targetNum = SqlSel.GetSqlScale(sqlCmd).ToString();
             if (!string.IsNullOrEmpty(targetNum))
             {
                 string url = string.Format("https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc1c3336a5eeb57ea&redirect_uri=http%3a%2f%2foa.mlily.com%3a30020%2fCheckOut%2fLeaveOut_leaderView.aspx?mainId={0}&response_type=code&scope=SCOPE&state=STATE#wechat_redirect", mainId);
                 WX2HK.ReturnInfo.messagePushByNum(targetNum + ";", "请假单", url, string.Format("来自 {0}的请假申请", label_name.Text), "");
             }
             Alert.ShowInTop("提交成功!");
             //提交按钮隐藏
             btnSubmit.Hidden = true;
             //表单重置
             PageContext.RegisterStartupScript(SimpleForm1.GetResetReference());
             //Image1.ImageUrl = null;
             hidden_field.Value = null;
         }
     }
     catch (Exception ex)
     {
         Alert.ShowInTop(ex.Message);
     }
 }