コード例 #1
0
        private void GetRequestTaskList(RequestsDAL requestDAL)
        {
            var query = _filterTaskManager.BuildApprovalWorkflowHistoryQuery(RequestsList.ListName, this.ApproverFullName, DateTime.Now);

            if (this.CountOnly)
            {
                TotalCount += requestDAL.CountByQuery(query);
            }
            else
            {
                var requestManagementList = requestDAL.GetByQuery(query);
                if (requestManagementList != null && requestManagementList.Count > 0)
                {
                    foreach (var requestManagement in requestManagementList)
                    {
                        var filterTask = new FilterTask(requestManagement);
                        filterTask.ApprovalStatusId = requestManagement.WFStatus == ApprovalStatus.Approved ? ApprovedStatusId
                            : requestManagement.WFStatus == ApprovalStatus.InProcess ? InProcessStatusId
                            : requestManagement.WFStatus == ApprovalStatus.Completed ? CompletedId
                            : requestManagement.WFStatus == ApprovalStatus.Rejected ? RejectedStatusId
                            : InProgressStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }
コード例 #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        int EmployeeId = Int32.Parse(Session["employeeid"].ToString());

        Employee     employee = EmployeeDAL.GetEmployee(EmployeeId);
        LeaveRequest request  = new LeaveRequest();

        request.EmployeeId = EmployeeId;

        request.StartDate      = Convert.ToDateTime(txtStartDate.Text);
        request.StartDate      = DateTime.Parse(txtStartDate.Text);
        request.EndDate        = DateTime.Parse(txtEndDate.Text);
        request.LeaveType      = ddlLeaveType.SelectedItem.Value;
        request.Reason         = txtReason.Text;
        request.RequestedOn    = DateTime.Now;
        request.Status         = "n"; // new
        request.Approve_Person = employee.Leader1.ToString();

        bool done = RequestsDAL.AddLeaveRequest(request);

        if (done)
        {
            lblMsg.Text = "Your request for leave has been stored";
        }
        else
        {
            lblMsg.Text = "Sorry! Could not store your request. Try again!";
        }
    }
コード例 #3
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        RequestsDAL.SearchLeaveRequest(ref dt, DateTime.Parse(txtStartDate.Text),
                                       DateTime.Parse(txtEndDate.Text), ddlLeaveType.SelectedItem.Value, txtName.Text);

        GridView1.DataSource = dt;
        GridView1.DataBind();


//      LeaveRequest request = new LeaveRequest();
//      request.EmployeeId = Int32.Parse(Session["employeeid"].ToString());
//
//      request.StartDate = Convert.ToDateTime(txtStartDate.Text);
//      request.StartDate = DateTime.Parse(txtStartDate.Text);
//      request.EndDate = DateTime.Parse(txtEndDate.Text);
//      request.LeaveType = ddlLeaveType.SelectedItem.Value;
//      request.Reason = txtReason.Text;
//      request.RequestedOn = DateTime.Now;
//      request.Status = "n"; // new
//
//      bool done = RequestsDAL.AddLeaveRequest(request);
//      if (done)
//          lblMsg.Text = "Your request for leave has been stored";
//      else
//          lblMsg.Text = "Sorry! Could not store your request. Try again!";
    }
コード例 #4
0
        private void GetRequestTaskList(RequestsDAL requestDAL)
        {
            var        requestByValue   = "Mua hàng/Buy new materials or equipments";
            List <int> delegatedItemIDs = this.DelegationList.Where(d => d.ListUrl == RequestsList.Url).Select(d => d.ListItemID).ToList();
            var        delegationQuery  = _filterTaskManager.BuildApprovedByDelegationQuery(_currentUserInfoId, RequestsList.PendingAtField, "Lookup", delegatedItemIDs);

            var query = $@"<Where>
                            <And>
                                <And>
                                    {delegationQuery}
                                    <Eq>
                                        <FieldRef Name='{ApprovalFields.WFStatus}' />
                                        <Value Type='Text'>{StringConstant.ApprovalStatus.InProgress}</Value>
                                    </Eq>
                                </And>
                                <Or>
                                    <And>
                                        <Neq>
                                            <FieldRef Name='{RequestsList.RequestTypeRefField}'/>
                                            <Value Type='Lookup'>{requestByValue}</Value>
                                        </Neq>
                                        <Gt>
                                            <FieldRef Name='{RequestsList.FinishDateField}' />
                                            <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.AddDays(1).ToString(StringConstant.DateFormatForCAML)}</Value>
                                        </Gt>
                                    </And>
                                    <And>
                                        <Eq>
                                            <FieldRef Name='{RequestsList.RequestTypeRefField}'/>
                                            <Value Type='Lookup'>{requestByValue}</Value>
                                        </Eq>
                                        <Leq>
                                            <FieldRef Name='{StringConstant.DefaultSPListField.CreatedField}' />
                                            <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.ToString(StringConstant.DateFormatForCAML)}</Value>
                                        </Leq>
                                    </And>
                                </Or>
                            </And>
                            </Where>";

            if (this.CountOnly)
            {
                TotalCount += requestDAL.CountByQuery(query);
            }
            else
            {
                var requestManagementList = requestDAL.GetByQuery(query);
                if (requestManagementList != null && requestManagementList.Count > 0)
                {
                    foreach (var requestManagement in requestManagementList)
                    {
                        var filterTask = new FilterTask(requestManagement);
                        filterTask.ApprovalStatusId = ApprovalStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// InitDALObject
        /// </summary>
        /// <param name="listUrl"></param>
        /// <param name="currentWeb"></param>
        /// <returns></returns>
        private static IDelegationManager InitDALObject(string listUrl, SPWeb currentWeb)
        {
            IDelegationManager moduleDAL = null;

            if (string.Compare(listUrl, ShiftManagementList.ListUrl, true) == 0)
            {
                moduleDAL = new ShiftManagementDAL(currentWeb.Url);
            }
            else if (string.Compare(listUrl, ChangeShiftList.ListUrl, true) == 0)
            {
                moduleDAL = new ChangeShiftManagementDAL(currentWeb.Url);
            }
            else if (string.Compare(listUrl, OverTimeManagementList.ListUrl, true) == 0)
            {
                moduleDAL = new OverTimeManagementDAL(currentWeb.Url);
            }
            else if (string.Compare(listUrl, NotOvertimeList.ListUrl, true) == 0)
            {
                moduleDAL = new NotOvertimeManagementDAL(currentWeb.Url);
            }
            else if (string.Compare(listUrl, VehicleManagementList.ListUrl, true) == 0)
            {
                moduleDAL = new VehicleManagementDAL(currentWeb.Url);
            }
            else if (string.Compare(listUrl, LeaveManagementList.ListUrl, true) == 0)
            {
                moduleDAL = new LeaveManagementDAL(currentWeb.Url);
            }
            else if (string.Compare(listUrl, FreightManagementList.ListUrl, true) == 0)
            {
                moduleDAL = new FreightManagementDAL(currentWeb.Url);
            }
            else if (string.Compare(listUrl, BusinessTripManagementList.Url, true) == 0)
            {
                moduleDAL = new BusinessTripManagementDAL(currentWeb.Url);
            }
            else if (string.Compare(listUrl, RequestsList.Url, true) == 0)
            {
                moduleDAL = new RequestsDAL(currentWeb.Url);
            }
            else if (string.Compare(listUrl, EmployeeRequirementSheetsList.Url, true) == 0)
            {
                moduleDAL = new EmployeeRequirementSheetDAL(currentWeb.Url);
            }
            else if (string.Compare(listUrl, RequestForDiplomaSuppliesList.Url, true) == 0)
            {
                moduleDAL = new RequestForDiplomaSupplyDAL(currentWeb.Url);
            }
            else if (string.Compare(listUrl, RequisitionOfMeetingRoomList.Url, true) == 0)
            {
                moduleDAL = new RequisitionOfMeetingRoomDAL(currentWeb.Url);
            }

            return(moduleDAL);
        }
コード例 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (RequestsDAL.IsReport(Int32.Parse(Session["employeeid"].ToString())) == false)
     {
         lblMsg.Text       = "您無此權限";
         GridView1.Visible = false;
     }
     else
     {
         dt = new DataTable();
         dt.Columns.Add("Employee");
         dt.Columns.Add("startdate");
         dt.Columns.Add("enddate");
         dt.Columns.Add("leavetype");
         dt.Columns.Add("reason");
         dt.Columns.Add("status");
     }
 }
コード例 #7
0
    protected void btnPermit_Click(object sender, EventArgs e)
    {
        RequestsDAL.UpdateLeaveRequest(Int32.Parse(Session["employeeid"].ToString()));
//         CabRequest cr = new CabRequest();
//         cr.EmployeeId = Int32.Parse(Session["employeeid"].ToString());
//         cr.FromPlace = Int32.Parse(ddlFromPlace.SelectedItem.Value);
//         cr.ToPlace = Int32.Parse(ddlToPlace.SelectedItem.Value);
//         cr.RequiredDate = DateTime.Parse(txtRequiredDate.Text);
//         cr.RequiredTime = txtRequiredTime.Text;
//         cr.RequestedOn = DateTime.Now;
//         cr.Remarks = txtRemarks.Text;
//         cr.Status = "n";
//      bool done = RequestsDAL.ResponseLeaveRequest(cr);
//         if (done)
//             lblMsg.Text = "Added Cab Request Successfully!";
//         else
//             lblMsg.Text = "Sorry! Could not add cab request!";
    }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (RequestsDAL.IsLeader(Int32.Parse(Session["employeeid"].ToString())) == false)
        {
            lblMsg.Text       = "您無此權限";
            GridView1.Visible = false;
        }
        else
        {
//          foreach (GridViewRow v in GridView1.Rows)
//          {
//              int n = 0;
//              if (Int32.TryParse(v.Cells[0].Text,out n) == true)
//              {
//                  string s = EmployeeDAL.GetEmployeeNmae(n);
//                  v.Cells[0].Text = s;
//              }
//          }
        }
    }
コード例 #9
0
 public void Visit(RequestsDAL requestDAL)
 {
     GetRequestTaskList(requestDAL);
 }