// Save a hiringRequest
        public static void Save(HiringRequestInfo hiringRequestInfo)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["ContosoHR"].ConnectionString;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SaveHiringRequest";

                command.Parameters.Add(new SqlParameter("@id", hiringRequestInfo.Id));
                command.Parameters.Add(new SqlParameter("@requesterId", hiringRequestInfo.RequesterId));
                command.Parameters.Add(new SqlParameter("@creationDate", hiringRequestInfo.CreationDate));
                command.Parameters.Add(new SqlParameter("@positionId", hiringRequestInfo.PositionId));
                command.Parameters.Add(new SqlParameter("@departmentId", hiringRequestInfo.DepartmentId));
                command.Parameters.Add(new SqlParameter("@description", hiringRequestInfo.Description));
                command.Parameters.Add(new SqlParameter("@title", hiringRequestInfo.Title));
                command.Parameters.Add(new SqlParameter("@workflowInstanceId", hiringRequestInfo.WorkflowInstanceId));
                command.Parameters.Add(new SqlParameter("@isCompleted", hiringRequestInfo.IsCompleted ? 1 : 0));
                command.Parameters.Add(new SqlParameter("@isSuccess", hiringRequestInfo.IsSuccess ? 1: 0 ));
                command.Parameters.Add(new SqlParameter("@isCancelled", hiringRequestInfo.IsCancelled ? 1: 0));

                command.ExecuteNonQuery();
            }
        }
        // Save a hiringRequest
        public static void Save(HiringRequestInfo hiringRequestInfo)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["ContosoHR"].ConnectionString;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SaveHiringRequest";

                command.Parameters.Add(new SqlParameter("@id", hiringRequestInfo.Id));
                command.Parameters.Add(new SqlParameter("@requesterId", hiringRequestInfo.RequesterId));
                command.Parameters.Add(new SqlParameter("@creationDate", hiringRequestInfo.CreationDate));
                command.Parameters.Add(new SqlParameter("@positionId", hiringRequestInfo.PositionId));
                command.Parameters.Add(new SqlParameter("@departmentId", hiringRequestInfo.DepartmentId));
                command.Parameters.Add(new SqlParameter("@description", hiringRequestInfo.Description));
                command.Parameters.Add(new SqlParameter("@title", hiringRequestInfo.Title));
                command.Parameters.Add(new SqlParameter("@workflowInstanceId", hiringRequestInfo.WorkflowInstanceId));
                command.Parameters.Add(new SqlParameter("@isCompleted", hiringRequestInfo.IsCompleted ? 1 : 0));
                command.Parameters.Add(new SqlParameter("@isSuccess", hiringRequestInfo.IsSuccess ? 1: 0));
                command.Parameters.Add(new SqlParameter("@isCancelled", hiringRequestInfo.IsCancelled ? 1: 0));

                command.ExecuteNonQuery();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            currentUser = (Employee)Session["user"];

            HiringRequestInfo info = new HiringRequestInfo { RequesterId = currentUser.Id };
            this.hiringRequestDetails1.HiringRequestInfo = info;
            this.hiringRequestDetails1.ShowCommentsField = false;
            this.hiringRequestDetails1.Editable = true;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // initialize data
            requestId = Request["id"];
            this.info = HiringRequestRepository.Load(requestId);
            this.currentUser = (Employee)Session["user"];

            // show request info
            this.hiringRequestDetails1.HiringRequestInfo = info;
            this.hiringRequestDetails1.Editable = false;
            this.hiringRequestHistory1.HiringRequestId = requestId;

            // only show the cancellation button to the requester
            if (!IsPostBack)
            {
                this.btnCancel.Visible = (!info.IsCompleted && info.RequesterId.Equals(currentUser.Id));
            }
        }
        protected void CreateClick(object sender, EventArgs e)
        {
            // create the hiringRequest info and populate it with data from the UI
            HiringRequestInfo requestInfo = new HiringRequestInfo()
            {
                Id = Guid.NewGuid(),
                RequesterId = currentUser.Id,
                CreationDate = DateTime.Now,
                DepartmentId = this.hiringRequestDetails1.DepartmentId,
                PositionId = this.hiringRequestDetails1.PositionId,
                Description = this.hiringRequestDetails1.Description,
                Title = this.hiringRequestDetails1.CreateRequestTitle(this.currentUser)
            };

            // start the hiring request
            HiringRequestServiceClient client = new HiringRequestServiceClient();
            client.StartProcess(requestInfo);
            client.Close();

            // update ui
            this.btnCancel.Text = "Request created, click here to go back to the Inbox";
            this.btnCancel.Width = new System.Web.UI.WebControls.Unit(400, System.Web.UI.WebControls.UnitType.Pixel);
            this.btnCreate.Visible = false;
        }
Esempio n. 6
0
 public static JobPosting Create(HiringRequestInfo hiringRequestInfo)
 {
     return(new JobPosting {
         Id = Guid.NewGuid(), HiringRequestInfo = hiringRequestInfo
     });
 }
Esempio n. 7
0
 public static JobPosting Create(HiringRequestInfo hiringRequestInfo)
 {
     return new JobPosting { Id = Guid.NewGuid(), HiringRequestInfo = hiringRequestInfo };
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            // get information from state
            requestId = Request["id"];
            state = Request["state"];

            // get the user
            currentUser = (Employee)Session["user"];

            // configure the control to show hiring request info
            info = HiringRequestRepository.Load(requestId);

            // set UI
            this.SetControlsVisibility();

            this.hiringRequestDetails1.HiringRequestInfo = info;
            this.hiringRequestDetails1.ShowCommentsField = true;
            this.hiringRequestHistory1.HiringRequestId = requestId;
        }