Exemplo n.º 1
0
    private void BindData()
    {
        JN_Journal m = new JN_JournalBLL((int)ViewState["ID"]).Model;

        pl_detail.BindData(m);

        if (m.InsertStaff != (int)Session["UserID"] || m.ApproveFlag == 1 || (DateTime.Today - m.InsertTime.Date).Days > 7)
        {
            pl_detail.SetControlsEnable(false);
            UploadFile1.CanDelete = false;
            UploadFile1.CanUpload = false;
            bt_OK.Visible         = false;
            bt_Delete.Visible     = false;
        }

        if ((DateTime.Today - m.InsertTime.Date).Days > 0)
        {
            bt_Delete.Visible = false;                                                      //只能删除当日的日志
        }
        #region 展示附件
        UploadFile1.RelateID   = (int)ViewState["ID"];
        UploadFile1.RelateType = 90;
        UploadFile1.BindGrid();
        #endregion

        lb_CommentCounts.Text = JN_JournalCommentBLL.GetModelList("JournalID=" + ViewState["ID"].ToString()).Count.ToString();
    }
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        JN_JournalCommentBLL commentbll = new JN_JournalCommentBLL();
        commentbll.Model.JournalID = Convert.ToInt32(ViewState["ID"]);
        commentbll.Model.Staff = int.Parse(Session["UserID"].ToString());
        commentbll.Model.Content = tbx_content.Text;
        commentbll.Model.CommentTime = DateTime.Now;
        commentbll.Add();

        BindGridList();

        //清空评论板内的内容
        tbx_content.Text = "";
    }
Exemplo n.º 3
0
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        JN_JournalCommentBLL commentbll = new JN_JournalCommentBLL();

        commentbll.Model.JournalID   = Convert.ToInt32(ViewState["ID"]);
        commentbll.Model.Staff       = int.Parse(Session["UserID"].ToString());
        commentbll.Model.Content     = content.Text;
        commentbll.Model.CommentTime = DateTime.Now;
        commentbll.Add();

        BindGridList();

        //清空评论板内的内容
        content.Text = "";
    }
Exemplo n.º 4
0
 private void BindGridList()
 {
     dgshow.DataSource = JN_JournalCommentBLL.GetModelList("JournalID=" + ViewState["ID"].ToString());
     dgshow.DataBind();
 }
Exemplo n.º 5
0
    private void BindData()
    {
        JN_Journal m = new JN_JournalBLL((int)ViewState["ID"]).Model;

        Org_StaffBLL staff = new Org_StaffBLL(m.Staff, true);

        select_Staff.SelectValue = m.Staff.ToString();
        select_Staff.SelectText  = staff.Model.RealName;
        select_Staff.Enabled     = false;
        Org_PositionBLL position = new Org_PositionBLL(staff.Model.Position);

        lbl_Position.Text = position.Model.Name;

        ddl_JournalType.SelectedValue = m.JournalType.ToString();
        ddl_JournalType_SelectedIndexChanged(null, null);
        ddl_JournalType.Enabled = false;

        tbx_begindate.Text = m.BeginTime.ToString("yyyy-MM-dd");
        tbx_enddate.Text   = m.EndTime.ToString("yyyy-MM-dd");
        try
        {
            ddl_BeginHour.SelectedValue   = m.BeginTime.Hour.ToString("d2");
            ddl_BeginMinute.SelectedValue = m.BeginTime.Minute.ToString("d2");
            ddl_EndHour.SelectedValue     = m.EndTime.Hour.ToString("d2");
            ddl_EndMinute.SelectedValue   = m.EndTime.Minute.ToString("d2");
        }
        catch { }

        ddl_WorkingClassify.SelectedValue = m.WorkingClassify.ToString();
        ddl_WorkingClassify_SelectedIndexChanged(null, null);
        ddl_WorkingClassify.Enabled = false;

        pl_detail.BindData(m);

        rbl_HasSynergeticStaff_SelectedIndexChanged(null, null);

        select_RelateClient_SelectChange(null, null);
        if (ddl_RelateLinkMan.Items.FindByValue(m.RelateLinkMan.ToString()) != null)
        {
            ddl_RelateLinkMan.SelectedValue = m.RelateLinkMan.ToString();
        }

        if (m.WorkingClassify == 1 && m.RelateLinkMan > 0)
        {
            //客户拜访
            bt_AddNewClient.OnClientClick = "javascript:OpenClientInput(" + m.ID.ToString() + "," + m.RelateLinkMan + ",0)";
            bt_AddNewClient.Enabled       = true;
        }
        else if (m.WorkingClassify == 3 && !string.IsNullOrEmpty(m["RelateActivity"]))
        {
            //活动举办
            bt_AddNewClient.OnClientClick = "javascript:OpenClientInput(" + m.ID.ToString() + ",0," + m["RelateActivity"] + ")";
            bt_AddNewClient.Enabled       = true;
        }
        else
        {
            bt_AddNewClient.Enabled = false;
        }
        #region 显示日志填报时的IP地址
        TextBox tbx_IPAddress = (TextBox)pl_detail.FindControl("JN_Journal_IPAddress");
        if (m["IPAddress"] != "" && m["IPLocation"] == "")
        {
            TextBox tbx_IPLocation = (TextBox)pl_detail.FindControl("JN_Journal_IPLocation");
            userAddress = Const_IPLocationBLL.FindByIP(Request.UserHostAddress);
            if (tbx_IPLocation != null)
            {
                tbx_IPLocation.Text = userAddress != null ? userAddress.Location : "";
            }
        }
        #endregion

        Label lbl_InsertStaff = (Label)pl_detail.FindControl("JN_Journal_InsertStaff");

        if (lbl_InsertStaff != null)
        {
            Org_StaffBLL    _staff    = new Org_StaffBLL(m.InsertStaff, true);
            Org_PositionBLL _position = new Org_PositionBLL(_staff.Model.Position);
            lbl_InsertStaff.Text = lbl_InsertStaff.Text + "(职位:" + _position.Model.Name + ")";
        }

        if (m.InsertStaff != (int)Session["UserID"] || m.ApproveFlag == 1 || (DateTime.Today - m.InsertTime.Date).Days > 7)
        {
            ddl_JournalType.Enabled     = false;
            tbx_begindate.Enabled       = false;
            ddl_WorkingClassify.Enabled = false;
            ddl_BeginHour.Enabled       = false;
            ddl_BeginMinute.Enabled     = false;
            ddl_EndHour.Enabled         = false;
            ddl_EndMinute.Enabled       = false;

            pl_detail.SetControlsEnable(false);
            TextBox tbx_remark = pl_detail.FindControl("JN_Journal_Remark") != null ?
                                 (TextBox)pl_detail.FindControl("JN_Journal_Remark") : null;
            if (tbx_remark != null)
            {
                tbx_remark.Enabled  = true;
                tbx_remark.ReadOnly = true;
            }
            UploadFile1.CanDelete = false;
            UploadFile1.CanUpload = false;
            bt_OK.Visible         = false;
            bt_Delete.Visible     = false;
        }

        if ((DateTime.Today - m.InsertTime.Date).Days > 0)
        {
            bt_Delete.Visible = false;                                                      //只能删除当日填写的日志
        }
        #region 展示附件
        UploadFile1.RelateID   = (int)ViewState["ID"];
        UploadFile1.RelateType = 90;
        UploadFile1.BindGrid();
        #endregion

        int commentcounts = JN_JournalCommentBLL.GetModelList("JournalID=" + ViewState["ID"].ToString()).Count;
        lb_CommentCounts.Text = commentcounts.ToString();
        if (commentcounts > 0)
        {
            table_comment.Visible = true;
            BindGridList();
            btn_LookComment.Visible = false;
        }
    }