Example #1
0
        /// <summary>
        /// 职员档案信息
        /// </summary>
        /// <returns></returns>
        public ActionResult Dangan()
        {
            string emp_no = Request.QueryString["id"];

            RenshiServiceSoapClient renshiService = new RenshiServiceSoapClient();
            DataTable dt     = renshiService.SearchUserinfo(emp_no);
            Dangan    dangan = new Dangan();

            if (dt.Rows.Count > 0)
            {
                dangan.Emp_no  = dt.Rows[0]["emp_no"].ToString();
                dangan.Emp_nm  = dt.Rows[0]["emp_nm"].ToString();
                dangan.Entr_dt = dt.Rows[0]["entr_dt"].ToString();
                dangan.Dept_nm = dt.Rows[0]["dept_nm"].ToString();
            }

            return(View(dangan));
        }
Example #2
0
        public ActionResult Qingjia()
        {
            //窗体加载时要先显示职员的部分档案信息
            string emp_no = Request.QueryString["id"];

            RenshiService.renshiSoapClient renshiService = new RenshiService.renshiSoapClient();
            DataSet ds     = renshiService.GetEmpinfo(emp_no);
            Dangan  dangan = new Dangan();

            if (ds.Tables[0].Rows.Count > 0)
            {
                dangan.Emp_no  = ds.Tables[0].Rows[0]["emp_no"].ToString();
                dangan.Emp_nm  = ds.Tables[0].Rows[0]["emp_nm"].ToString();
                dangan.Entr_dt = ds.Tables[0].Rows[0]["entr_dt"].ToString();
                dangan.Dept_nm = ds.Tables[0].Rows[0]["dept_nm"].ToString();
            }

            return(View(dangan));
        }
Example #3
0
        public ActionResult Qingjia(FormCollection collection)
        {
            string emp_no = Request.QueryString["id"];//职员工号
            RenshiServiceSoapClient renshiService = new RenshiServiceSoapClient();
            DataTable dt     = renshiService.SearchUserinfo(emp_no);
            Dangan    dangan = new Dangan();

            if (dt.Rows.Count > 0)
            {
                dangan.Emp_no  = dt.Rows[0]["emp_no"].ToString();
                dangan.Emp_nm  = dt.Rows[0]["emp_nm"].ToString();
                dangan.Entr_dt = dt.Rows[0]["entr_dt"].ToString();
                dangan.Dept_nm = dt.Rows[0]["dept_nm"].ToString();
            }

            //把用户提交的请假申请insert到数据表中,然后接收返回的信息
            RenshiService.HEX001TB hex001tb = new RenshiService.HEX001TB();
            //生成一个随机串,用作主键
            string ss = System.Guid.NewGuid().ToString();
            string s2 = ss.Substring(24, 12);

            hex001tb.id        = s2;
            hex001tb.emp_no    = emp_no;
            hex001tb.ex_date   = Convert.ToDateTime(collection["ex_date"]);
            hex001tb.dilig_cd  = collection["combox_dilig"];
            hex001tb.ex_btime  = collection["ex_btime"];
            hex001tb.ex_etime  = collection["ex_etime"];
            hex001tb.ex_remark = collection["ex_remark"];
            hex001tb.ins_no    = emp_no;
            dt = null;
            dt = renshiService.AddHEX001TB(hex001tb);

            if (dt.Rows.Count > 0)
            {
                string msg_cd   = dt.Rows[0]["msg_cd"].ToString();
                string msg_text = dt.Rows[0]["msg_text"].ToString();
                //如果返回0,则说明保存成功,此时需要发送消息给管理员审核
                if (msg_cd == "0")
                {
                    //保存成功后发送信息给审核人员
                    string agentid    = ConfigurationManager.AppSettings["AgentIdForRenshi"];
                    string send_class = ConfigurationManager.AppSettings["PushMsgForQingJiaRenshi"];
                    SendMessageServiceSoapClient sendMessageService = new SendMessageServiceSoapClient();
                    Error error = new Error();
                    //推送请假审核信息给审核者
                    error = sendMessageService.QingJiaPushMessage(hex001tb.id, agentid, send_class, "insert_succeed");
                    //根据返回的信息来判断是否推送信息成功
                    if (error.errcode == 0) //推送成功
                    {
                        dangan.msg_cd   = msg_cd;
                        dangan.msg_text = msg_text;
                    }
                    else//推送失败,则要把登记的请假信息删除,并推送一条信息给申请的用户,告知推送失败了。
                    {
                        dangan.msg_cd   = error.errcode.ToString();
                        dangan.msg_text = error.errmsg;
                        //推送失败信息给请假申请者
                        sendMessageService.QingJiaPushMessage(hex001tb.id, agentid, send_class, "sending_failure");
                        //删除请假申请信息
                        renshiService.DeleteHEX001TB(hex001tb);
                    }
                }
            }
            return(View(dangan));
        }
Example #4
0
        public ActionResult Qingjia(FormCollection collection)
        {
            string emp_no = Request.QueryString["id"];//职员工号

            RenshiService.renshiSoapClient renshiService = new RenshiService.renshiSoapClient();
            DataSet ds     = renshiService.GetEmpinfo(emp_no);
            Dangan  dangan = new Dangan();

            if (ds.Tables[0].Rows.Count > 0)
            {
                dangan.Emp_no  = ds.Tables[0].Rows[0]["emp_no"].ToString();
                dangan.Emp_nm  = ds.Tables[0].Rows[0]["emp_nm"].ToString();
                dangan.Entr_dt = ds.Tables[0].Rows[0]["entr_dt"].ToString();
                dangan.Dept_nm = ds.Tables[0].Rows[0]["dept_nm"].ToString();
            }

            //把职员请假的消息发送给应用接受并返回一个提示消息给管理员
            string corpid = ConfigurationManager.AppSettings["CorpId"];   //企业ID
            string secret = ConfigurationManager.AppSettings["Secret_3"]; //应用的凭证密钥 每个应用都不一样

            //把用户提交的请假申请insert到数据表中,然后接收返回的信息
            wx_site.RenshiService.HEX001TB hex001tb = new RenshiService.HEX001TB();
            //生成一个随机串,用作主键
            string ss = System.Guid.NewGuid().ToString();
            string s2 = ss.Substring(24, 12);

            hex001tb.id        = s2;
            hex001tb.emp_no    = emp_no;
            hex001tb.ex_date   = Convert.ToDateTime(collection["ex_date"]);
            hex001tb.dilig_cd  = collection["combox_dilig"];
            hex001tb.ex_btime  = collection["ex_btime"];
            hex001tb.ex_etime  = collection["ex_etime"];
            hex001tb.ex_remark = collection["ex_remark"];
            hex001tb.ins_no    = emp_no;
            ds = renshiService.AddHEX001TB(hex001tb);

            if (ds.Tables["MSG"].Rows.Count > 0)
            {
                string msg_cd   = ds.Tables["MSG"].Rows[0]["msg_cd"].ToString();
                string msg_text = ds.Tables["MSG"].Rows[0]["msg_text"].ToString();
                //如果返回0,则说明保存成功,此时需要发送消息给管理员审核
                if (msg_cd == "0")
                {
                    //要把用户提交的信息封装为一个model,并转换成json包
                    //首先发送的消息内容需要封装成一个json包
                    //消息以卡片文本的形式发送,其中需要参数。
                    Msg_Text_card_content text_card = new Msg_Text_card_content();
                    text_card.title       = ds.Tables["MSG"].Rows[0]["title"].ToString();
                    text_card.description = ds.Tables["MSG"].Rows[0]["description"].ToString();
                    text_card.url         = ds.Tables["MSG"].Rows[0]["url"].ToString();
                    text_card.btntxt      = ds.Tables["MSG"].Rows[0]["btntxt"].ToString();
                    //转换成json包之前先处理一下反斜杠 \
                    Json_Replace json_Replace = new Json_Replace();
                    text_card.description = json_Replace.Json_add_4(text_card.description);
                    //转换成json包
                    string text_content_json = JsonConvert.SerializeObject(text_card);

                    //再封装POST提交需要的JSON包
                    Msg_Text_card msg_Text_Card = new Msg_Text_card();
                    msg_Text_Card.touser   = ds.Tables["MSG"].Rows[0]["touser"].ToString();
                    msg_Text_Card.toparty  = ds.Tables["MSG"].Rows[0]["toparty"].ToString();
                    msg_Text_Card.totag    = ds.Tables["MSG"].Rows[0]["totag"].ToString();
                    msg_Text_Card.msgtype  = ds.Tables["MSG"].Rows[0]["msgtype"].ToString();
                    msg_Text_Card.agentid  = int.Parse(ds.Tables["MSG"].Rows[0]["agentid"].ToString());
                    msg_Text_Card.textcard = text_content_json;
                    //Json.NET序列化
                    string jsonData = JsonConvert.SerializeObject(msg_Text_Card);
                    //过滤掉其中的一些特殊符号,使其试用于微信接口的规范。
                    jsonData = json_Replace.Json_rep(jsonData);
                    //推送消息给管理员审核
                    SendMessage sendMessage = new SendMessage();
                    string      strjson     = sendMessage.SendMsg(corpid, secret, jsonData);
                }
                dangan.msg_cd   = msg_cd;
                dangan.msg_text = msg_text;
            }
            return(View(dangan));
        }