Esempio n. 1
0
    /// <summary>
    /// 根据编号获取指定的出差总结报告记录
    /// </summary>
    /// <param name="recordID"></param>
    /// <returns></returns>
    public static BusinessTripSummary GetBusinessTripReiByID(int recordID)
    {
        SqlConnection conn = new SqlConnection(connString);
        SqlCommand cmd = new SqlCommand("SELECT * FROM [BusinessTripSummary] WHERE [RecordID] = @RecordID", conn);
        cmd.Parameters.Add("@RecordID", SqlDbType.Int).Value = recordID;
        conn.Open();
        SqlDataReader sdr = cmd.ExecuteReader();
        BusinessTripSummary bi = null;
        if (sdr.Read())
        {
            bi = new BusinessTripSummary();
            bi.staffName = (string)sdr["StaffName"];
            bi.departmentName = (string)sdr["DepartmentName"];
            bi.startDate = Convert.ToDateTime(sdr["StartDate"]);
            bi.endDate = Convert.ToDateTime(sdr["EndDate"]);

            bi.projectName = (string)sdr["ProjectName"];
            bi.location = (string)sdr["Location"];
            bi.reason = (string)sdr["Reason"];
            bi.expense = (string)sdr["Expense"];
            bi.travels = (string)sdr["Travel"];
            bi.finished = (string)sdr["Finished"];
            bi.unfinished = (string)sdr["Unfinished"];

            bi.ApproveProcess = sdr["ApproveProcess"] == DBNull.Value ? "" : (string)sdr["ApproveProcess"];
        }
        sdr.Close();
        conn.Close();
        return bi;
    }
    private void updateApprove(string if_agree, string next, BasicInfo info, bool if_back)
    {
        //更新审批流程
        int recordID           = Convert.ToInt32(Request["RecordID"]);
        BusinessTripSummary bi = BusinessTripSummary.GetBusinessTripReiByID(recordID);

        bi.ApproveProcess += info.StaffName.Trim() + "-" + if_agree + ",";
        BusinessTripSummary.SetBusinessTripApplyByID(bi, recordID);
        //更新下一审批人
        int    applyID      = Convert.ToInt32(Request["ApplyID"]);
        string nextApprover = next;

        Apply.UpdateNextApprover(applyID, nextApprover, if_back);
    }
Esempio n. 3
0
    /// <summary>
    /// 新增或更新出差总结报告
    /// </summary>
    /// <param name="bi"></param>
    /// <param name="id"></param>
    public static void SetBusinessTripApplyByID(BusinessTripSummary bi, int id)
    {
        SqlConnection conn = new SqlConnection(connString);
        SqlCommand cmd;
        bool isExist = HasBusinessTripSummary(id);
        if (!isExist)
        {
            cmd = new SqlCommand("INSERT INTO [BusinessTripSummary] ([StaffName], [Department], [StartDate], [EndDate], [ProjectName], [Location], [Expense], [Travel], [Reason], [Finished], [Unfinished], [ApproveProcess]) VALUES (@StaffName, @Department, @StartDate, @EndDate, @ProjectName, @Location, @Expense, @Travel, @Reason, @Finished, @Unfinished, @ApproveProcess) Select @@Identity as 'Identity'", conn);
        }
        else
        {
            cmd = new SqlCommand("UPDATE [BusinessTripSummary] SET [ApproveProcess]=@ApproveProcess WHERE [RecordID] = @RecordID", conn);
        }
        cmd.Parameters.Add("@RecordID", SqlDbType.Int).Value = id;
        cmd.Parameters.Add("@StaffName", SqlDbType.VarChar).Value = bi.staffName;
        cmd.Parameters.Add("@Department", SqlDbType.VarChar).Value = bi.departmentName;
        cmd.Parameters.Add("@StartDate", SqlDbType.DateTime).Value = bi.startDate;
        cmd.Parameters.Add("@EndDate", SqlDbType.DateTime).Value = bi.endDate;
        cmd.Parameters.Add("@ProjectName", SqlDbType.VarChar).Value = bi.projectName;
        cmd.Parameters.Add("@Location", SqlDbType.VarChar).Value = bi.location;
        cmd.Parameters.Add("@Reason", SqlDbType.VarChar).Value = bi.reason;
        cmd.Parameters.Add("@Travel", SqlDbType.VarChar).Value = bi.travels;
        cmd.Parameters.Add("@Expense", SqlDbType.VarChar).Value = bi.expense;
        cmd.Parameters.Add("@Finished", SqlDbType.VarChar).Value = bi.finished;
        cmd.Parameters.Add("@Unfinished", SqlDbType.VarChar).Value = bi.finished;
        cmd.Parameters.Add("@ApproveProcess", SqlDbType.VarChar).Value = bi.approveProcess;

        conn.Open();
        //cmd.ExecuteNonQuery();
        //同时在标准化申请表中插入一条记录
        int recordId = Convert.ToInt32(cmd.ExecuteScalar());
        if (!isExist)
        {
            SqlCommand cmd2 = new SqlCommand("INSERT INTO [AllApplies] ( [ApplyStaff], [ApplyDate], [ApplyType], [NextApprover], [RecordID], [Result]) VALUES (@ApplyStaff, @ApplyDate, @ApplyType, @NextApprover, @RecordID, @Result)", conn);
            cmd2.Parameters.Add("@ApplyStaff", SqlDbType.VarChar).Value = bi.staffName;
            cmd2.Parameters.Add("@ApplyDate", SqlDbType.DateTime).Value = DateTime.Now;
            cmd2.Parameters.Add("@ApplyType", SqlDbType.VarChar).Value = "出差总结报告";
            cmd2.Parameters.Add("@RecordID", SqlDbType.Int).Value = recordId;
            cmd2.Parameters.Add("@NextApprover", SqlDbType.VarChar).Value = bi.StaffName;
            cmd2.Parameters.Add("@Result", SqlDbType.Bit).Value = false;
            cmd2.ExecuteNonQuery();

        }

        conn.Close();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int  recordID          = Convert.ToInt32(Request["RecordID"]);
        bool approveFinished   = Convert.ToBoolean(Request["finished"]);
        BusinessTripSummary bi = BusinessTripSummary.GetBusinessTripReiByID(recordID);

        if (!IsPostBack)
        {
            staffName.Text   = bi.StaffName;
            department.Text  = bi.DepartmentName;
            duringDate.Text  = bi.StartDate.ToShortDateString() + "至" + bi.EndDate.ToShortDateString();
            projectName.Text = bi.ProjectName;
            location.Text    = bi.Location;
            expense.Text     = bi.Expense;
            travel.Text      = bi.Travels;
            reason.Text      = bi.Reason;
            finished.Text    = bi.Finished;
            unfinished.Text  = bi.Unfinished;

            processShow.Text = bi.ApproveProcess;
        }
        //用户权限相关显示功能
        Users     usr  = (Users)Session["Identify"];
        BasicInfo info = BasicInfo.GetBasicInfoByID(usr.UserID);

        if (approveFinished)
        {
            agreeButton.Visible    = false;
            disagreeButton.Visible = false;
            whyDisagree.Visible    = false;
        }
        else if (info.StaffName.Trim() == bi.StaffName.Trim() || info.Position.Trim() == "出纳")
        {
            agreeButton.Visible    = false;
            disagreeButton.Visible = false;

            if (info.Position.Trim() != "出纳")
            {
                whyDisagree.Visible = false;
            }
        }
        //测试阶段保持处理流程可见,运行阶段记得去掉
        processShow.Visible = true;
    }
Esempio n. 5
0
    protected void confirm_Click(object sender, EventArgs e)
    {
        BusinessTripSummary bi = new BusinessTripSummary();

        bi.StaffName      = staffName.Text;
        bi.DepartmentName = department.Text;
        bi.StartDate      = Convert.ToDateTime(startDate.Value);
        bi.EndDate        = Convert.ToDateTime(endDate.Value);

        bi.ProjectName    = projectNameList.SelectedValue;
        bi.Location       = location.Value;
        bi.Reason         = reason.Text;
        bi.Expense        = expense.Text;
        bi.Travels        = travels.Text;
        bi.Finished       = finished.Text;
        bi.Unfinished     = unfinished.Text;
        bi.ApproveProcess = "";

        BusinessTripSummary.SetBusinessTripApplyByID(bi, -1);
        Response.Redirect("~/Account/ApplyListPage.aspx");
    }