Example #1
0
    protected OAJournal GetModel(int ii)
    {
        OAJournal model = new OAJournal();

        model.Id          = this.KeyId.Value;
        model.title       = this.title.Text;                                 //标题
        model.type_id     = this.type_id.SelectedValue.ToString();           //日志类型
        model.start_time  = Convert.ToDateTime(start_time.Text.ToString());; //日志开始时间
        model.end_time    = Convert.ToDateTime(end_time.Text.ToString());    //日志结束时间
        model.content     = this.content.Text;                               //内容
        model.status      = ii;                                              //日志状态(0草稿;1提交)
        model.creater     = base.UserCode.ToString();                        //创建人ID
        model.create_date = DateTime.Now;                                    //创建时间
        if (!string.IsNullOrEmpty(hdnProjectCode.Value.ToString()))
        {
            model.project_id = hdnProjectCode.Value.ToString();//关联项目ID
        }
        if (!string.IsNullOrEmpty(hdntask_id.Value.ToString()))
        {
            model.task_id = hdntask_id.Value.ToString();//关联任务ID
        }

        //model.voices = "";//关联语音
        //model.vidios = "";//关联视频
        //model.cover = "";//封面
        return(model);
    }
Example #2
0
 private void Bind(string Id)
 {
     if (!string.IsNullOrEmpty(Id))
     {
         OAJournal model = this.pcSer.GetById(Id);
         if (model != null)
         {
             this.type_id.Text     = pcSer5.GetById(model.type_id.ToString()).name;                                 //日志类型
             this.creater.Text     = pcSer3.GetName(model.creater);                                                 //填写人
             this.create_date.Text = Convert.ToDateTime(model.create_date.ToString()).ToString("yyyy-MM-dd HH:mm"); //日志更新时间
             this.KeyId.Value      = model.Id;                                                                      //主键
             this.title.Text       = model.title;                                                                   //标题
             this.content.Text     = model.content;                                                                 //内容
             this.start_time.Text  = Convert.ToDateTime(model.start_time.ToString()).ToString("yyyy-MM-dd HH:mm");  //日志开始时间
             this.end_time.Text    = Convert.ToDateTime(model.end_time.ToString()).ToString("yyyy-MM-dd HH:mm");    //日志结束时间
             TimeSpan timeSpan = Convert.ToDateTime(model.end_time.ToString()) - Convert.ToDateTime(model.start_time.ToString());
             this.txtValue.Text = timeSpan.TotalMinutes.ToString();                                                 ///时间差值(分钟)
             DataTable dt1 = publicDbOpClass.DataTableQuary("select PrjName from PT_PrjInfo WHERE PrjGuid in (select project_id FROM OA_Journal WHERE id='" + Id + "') ");
             if (dt1.Rows.Count > 0)
             {
                 this.txtProject.Text = dt1.Rows[0]["PrjName"].ToString();//关联项目
             }
             else
             {
                 this.txtProject.Text = "";//关联项目
             }
             DataTable dt = publicDbOpClass.DataTableQuary(@"select OA_Journal_Append.user_id,OA_Journal_Append.user_type,PT_yhmc.v_xm from OA_Journal_Append 
                               left join PT_yhmc on OA_Journal_Append.user_id=PT_yhmc.v_yhdm where journal_id='" + model.Id + "'");
             string    strSYRID = "", strSYRXM = "", strXGRID = "", strXGRXM = "";
             foreach (DataRow dr in dt.Rows)
             {
                 //0 审阅人、1相关人、2审阅及相关人;
                 if (dr["user_type"].ToString() == "0")
                 {
                     strSYRID += dr["user_id"].ToString() + ";";
                     strSYRXM += dr["v_xm"].ToString() + ";";
                 }
                 if (dr["user_type"].ToString() == "1")
                 {
                     strXGRID += dr["user_id"].ToString() + ";";
                     strXGRXM += dr["v_xm"].ToString() + ";";
                 }
                 if (dr["user_type"].ToString() == "2")
                 {
                     strSYRID += dr["user_id"].ToString() + ";";
                     strSYRXM += dr["v_xm"].ToString() + ";";
                     strXGRID += dr["user_id"].ToString() + ";";
                     strXGRXM += dr["v_xm"].ToString() + ";";
                 }
             }
             //审阅人
             this.txtTo.Text = strSYRXM;
             //相关人
             this.txtCopyto.Text = strXGRXM;
         }
     }
 }
Example #3
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);
        }
        base.RegisterScript("top.ui.tabSuccess({parentName:'_Journal'});");
    }
Example #4
0
    private void Bind(string Id, string action)
    {
        if (!string.IsNullOrEmpty(Id))
        {
            OAJournal model = this.pcSer.GetById(Id);
            if (model != null)
            {
                this.type_id.SelectedValue = model.type_id.ToString();//日志类型
                if (this.action == "add")
                {
                    this.start_time.Text   = Convert.ToDateTime(model.end_time.ToString()).AddMinutes(1).ToString("yyyy-MM-dd HH:mm");  //开始时间//DateTime.Now.ToString("yyyy-MM-dd HH:mm");//开始时间
                    this.end_time.Text     = Convert.ToDateTime(model.end_time.ToString()).AddMinutes(61).ToString("yyyy-MM-dd HH:mm"); //结束时间
                    this.txtValue.Text     = "60";                                                                                      //持续时间(分钟)
                    this.ddl.SelectedValue = "60";
                    DataTable dt0 = publicDbOpClass.DataTableQuary(@"select* from OA_Journal_Type  where Id='" + model.type_id.ToString() + "'");
                    this.title.Text   = dt0.Rows[0]["title_temp"].ToString();   //标题
                    this.content.Text = dt0.Rows[0]["content_temp"].ToString(); //内容
                }
                else
                {
                    this.KeyId.Value     = model.Id;                                                                     //主键
                    this.title.Text      = model.title;                                                                  //标题
                    this.content.Text    = model.content;                                                                //内容
                    this.start_time.Text = Convert.ToDateTime(model.start_time.ToString()).ToString("yyyy-MM-dd HH:mm"); //开始时间
                    this.end_time.Text   = Convert.ToDateTime(model.end_time.ToString()).ToString("yyyy-MM-dd HH:mm");   //结束时间

                    TimeSpan timeSpan = Convert.ToDateTime(model.end_time.ToString()) - Convert.ToDateTime(model.start_time.ToString());
                    this.txtValue.Text = timeSpan.TotalMinutes.ToString();///持续时间(分钟)
                }

                if (!string.IsNullOrEmpty(model.project_id))
                {
                    this.hdnProjectCode.Value = model.project_id;//关联项目ID
                    DataTable dt1 = publicDbOpClass.DataTableQuary("select PrjName from PT_PrjInfo WHERE PrjGuid='" + model.project_id + "'");
                    if (dt1.Rows.Count > 0)
                    {
                        this.txtProject.Value = dt1.Rows[0]["PrjName"].ToString();//关联项目
                    }
                    else
                    {
                        this.txtProject.Value = "";//关联项目
                    }
                }
                else
                {
                    this.txtProject.Value = "";//关联项目
                }
                if (!string.IsNullOrEmpty(model.task_id))
                {
                    this.hdntask_id.Value = model.task_id;//关联任务ID
                    DataTable dt1 = publicDbOpClass.DataTableQuary("select title from OA_Task WHERE id='" + model.task_id + "'");
                    if (dt1.Rows.Count > 0)
                    {
                        this.task_id.Value = dt1.Rows[0]["title"].ToString();//关联任务
                    }
                    else
                    {
                        this.task_id.Value = "";//关联任务
                    }
                }
                else
                {
                    this.task_id.Value = "";//关联任务
                }

                //model.status = ii;//日志状态(0草稿;1提交)
                //model.creater = base.UserCode.ToString();//创建人ID
                //model.create_date = DateTime.Now;//创建时间
                //model.voices = "";//关联语音
                //model.vidios = "";//关联视频
                //model.cover = "";//封面
                DataTable dt = publicDbOpClass.DataTableQuary(@"select OA_Journal_Append.user_id,OA_Journal_Append.user_type,PT_yhmc.v_xm from OA_Journal_Append 
                                  left join PT_yhmc on OA_Journal_Append.user_id=PT_yhmc.v_yhdm where journal_id='" + model.Id + "'");
                string    strSYRID = "", strSYRXM = "", strXGRID = "", strXGRXM = "";
                foreach (DataRow dr in dt.Rows)
                {
                    //0 审阅人、1相关人、2审阅及相关人;
                    if (dr["user_type"].ToString() == "0")
                    {
                        strSYRID = dr["user_id"].ToString();
                        strSYRXM = dr["v_xm"].ToString();
                    }
                    if (dr["user_type"].ToString() == "1")
                    {
                        strXGRID += dr["user_id"].ToString() + ",";
                        strXGRXM += dr["v_xm"].ToString() + ",";
                    }
                    if (dr["user_type"].ToString() == "2")
                    {
                        strSYRID  = dr["user_id"].ToString();
                        strSYRXM  = dr["v_xm"].ToString();
                        strXGRID += dr["user_id"].ToString() + ",";
                        strXGRXM += dr["v_xm"].ToString() + ",";
                    }
                }
                //审阅人
                this.hfldTo.Value = strSYRID;
                this.txtTo.Text   = strSYRXM;
                //相关人
                if (strXGRID.Length > 0)
                {
                    this.hfldCopyto.Value = strXGRID.Substring(0, strXGRID.Length - 1);
                    this.txtCopyto.Text   = strXGRXM.Substring(0, strXGRXM.Length - 1);
                }
            }
        }
    }
Example #5
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'});");
    }
Example #6
0
    private void Bind(string Id)
    {
        if (!string.IsNullOrEmpty(Id))
        {
            OAJournal model = this.pcSer.GetById(Id);
            if (model != null)
            {
                this.type_id.Text = pcSer5.GetById(model.type_id.ToString()).name;//日志类型
                //if (this.action == "add")
                //{
                //    this.start_time.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm");//日志开始时间
                //    this.end_time.Text = DateTime.Now.AddHours(1).ToString("yyyy-MM-dd HH:mm");//日志结束时间
                //    //TimeSpan timeSpan = Convert.ToDateTime(model.end_time.ToString()) - Convert.ToDateTime(model.start_time.ToString());
                //    this.txtValue.Text = "60";///时间差值(分钟)
                //    DataTable dt0 = publicDbOpClass.DataTableQuary(@"select* from OA_Journal_Type  where Id='" + model.type_id.ToString() + "'");
                //    this.title.Text = dt0.Rows[0]["title_temp"].ToString();//标题
                //    this.content.Text = dt0.Rows[0]["content_temp"].ToString();//内容
                //}
                //else
                //{

                this.creater.Text     = pcSer3.GetName(model.creater);                                                 //填写人
                this.create_date.Text = Convert.ToDateTime(model.create_date.ToString()).ToString("yyyy-MM-dd HH:mm"); //日志更新时间
                this.KeyId.Value      = model.Id;                                                                      //主键
                this.title.Text       = model.title;                                                                   //标题
                this.content.Text     = model.content;                                                                 //内容
                this.start_time.Text  = Convert.ToDateTime(model.start_time.ToString()).ToString("yyyy-MM-dd HH:mm");  //日志开始时间
                this.end_time.Text    = Convert.ToDateTime(model.end_time.ToString()).ToString("yyyy-MM-dd HH:mm");    //日志结束时间
                TimeSpan timeSpan = Convert.ToDateTime(model.end_time.ToString()) - Convert.ToDateTime(model.start_time.ToString());
                this.txtValue.Text = timeSpan.TotalMinutes.ToString();                                                 ///时间差值(分钟)
                //}
                //this.hdnProjectCode.Text = model.project_id;//关联项目ID
                DataTable dt1 = publicDbOpClass.DataTableQuary("select PrjName from PT_PrjInfo WHERE PrjGuid='" + model.project_id + "'");
                if (dt1.Rows.Count > 0)
                {
                    this.txtProject.Text = dt1.Rows[0]["PrjName"].ToString();//关联项目
                }
                else
                {
                    this.txtProject.Text = "";//关联项目
                }

                //model.status = ii;//日志状态(0草稿;1提交)
                //model.voices = "";//关联语音
                //model.vidios = "";//关联视频
                //model.cover = "";//封面
                DataTable dt = publicDbOpClass.DataTableQuary(@"select OA_Journal_Append.user_id,OA_Journal_Append.user_type,PT_yhmc.v_xm from OA_Journal_Append 
                                  left join PT_yhmc on OA_Journal_Append.user_id=PT_yhmc.v_yhdm where journal_id='" + model.Id + "'");
                string    strSYRID = "", strSYRXM = "", strXGRID = "", strXGRXM = "";
                foreach (DataRow dr in dt.Rows)
                {
                    //0 审阅人、1相关人、2审阅及相关人;
                    if (dr["user_type"].ToString() == "0")
                    {
                        strSYRID += dr["user_id"].ToString() + ";";
                        strSYRXM += dr["v_xm"].ToString() + ";";
                    }
                    if (dr["user_type"].ToString() == "1")
                    {
                        strXGRID += dr["user_id"].ToString() + ";";
                        strXGRXM += dr["v_xm"].ToString() + ";";
                    }
                    if (dr["user_type"].ToString() == "2")
                    {
                        strSYRID += dr["user_id"].ToString() + ";";
                        strSYRXM += dr["v_xm"].ToString() + ";";
                        strXGRID += dr["user_id"].ToString() + ";";
                        strXGRXM += dr["v_xm"].ToString() + ";";
                    }
                }
                //审阅人
                //this.hfldTo.Value = strSYRID;
                this.txtTo.Text = strSYRXM;
                //相关人
                //this.hfldCopyto.Value = strXGRID;
                this.txtCopyto.Text = strXGRXM;
            }
        }
    }