public void Delete(OrganizationalUnitEntity t) { SqlConnection conn = null; SqlCommand cmd = null; try { conn = DALHelper.CreateSqlDbConnection(); cmd = new SqlCommand("usp_DeleteOrganizationalUnit", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Id", t.Id); cmd.ExecuteNonQuery(); } catch (Exception) { throw; } finally { conn.Close(); cmd.Dispose(); conn.Dispose(); } }
public void Update(OrganizationalUnitEntity t, int?ParentId) { SqlConnection conn = null; SqlCommand cmd = null; try { conn = DALHelper.CreateSqlDbConnection(); cmd = new SqlCommand("usp_UpdateOrganizationalUnit", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Id", t.Id); cmd.Parameters.AddWithValue("@Title", t.Title); cmd.Parameters.AddWithValue("@Description", t.Description); if (ParentId != null) { cmd.Parameters.AddWithValue("@ParentId", ParentId); } cmd.Parameters.AddWithValue("@OrganizationalUnitGroupId", t.OrganizationaUnitGroupId); cmd.Parameters.AddWithValue("@Status", t.Status); t.Id = Convert.ToInt32(cmd.ExecuteScalar()); } catch (Exception) { throw; } finally { conn.Close(); cmd.Dispose(); conn.Dispose(); } }
protected void ProceedButton_Click(object sender, EventArgs e) { JobDetailsSessionView jbs = new JobDetailsSessionView(); FunctionalLevelEntity flentity = new FunctionalLevelEntity(); flentity.Id = Convert.ToInt32(FunctionalLevelDropDownList.SelectedValue); flentity = new FunctionalLevelMapper().Get(flentity); jbs.FunctionalLevel = flentity; OrganizationalUnitEntity ouentity = new OrganizationalUnitEntity(); ouentity.Id = Convert.ToInt32(OrganisationalUnitDropDownList.SelectedValue); OrganizationalUnitView ouView = new OrganizationalUnitMapper().Get(ouentity); jbs.OrganisationalUnit = ouView; GradeEntity gentity = new GradeEntity(); gentity.Id = GradeDropDownList.SelectedValue; gentity = new GradeMapper().Get(gentity); jbs.Grade = gentity; JobTitleEntity job = new JobTitleEntity(); job.JobCode = JobDetailsDropDownList.SelectedValue; JobTitleView jobview = new JobTitleMapper().Get(job); jbs.Job = jobview; StepEntity sentity = new StepEntity(); sentity.Id = StepDropDownList.SelectedValue; sentity = new StepMapper().Get(sentity); jbs.Step = sentity; foreach (ListItem item in ContractsCheckBoxList.Items) { if (item.Selected == true) { jbs.ContractsTemplates.Add(new ContractTemplateEntity() { Id = Convert.ToInt32(item.Value), Title = item.Text }); } } Session.Add("JobDetails", jbs); Response.Redirect("Contract.aspx?EmployeeId=" + Request.QueryString["EmployeeId"] + "&ContractTemplateId=" + jbs.ContractsTemplates[0].Id); }
protected void ProceedButton_Click(object sender, EventArgs e) { OrganizationalUnitEntity entity = new OrganizationalUnitEntity(); entity.Title = TitleTextBox.Text; entity.Description = OtherInfoTextBox.Text; entity.OrganizationaUnitGroupId = Convert.ToInt32(OrganizationalUnitGroupDropDownList.SelectedValue); if (ParentDropDownList.SelectedValue != "") { new OrganizationalUnitMapper().InsertWithParent(entity, Convert.ToInt32(ParentDropDownList.SelectedValue)); } else { new OrganizationalUnitMapper().InsertWithParent(entity, null); } Response.Redirect("List.aspx"); }
public OrganizationalUnitView GetParent(OrganizationalUnitEntity t) { SqlConnection conn = null; SqlCommand cmd = null; try { conn = DALHelper.CreateSqlDbConnection(); cmd = new SqlCommand("usp_GetOrganisationalUnitParent", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Id", t.Id); SqlDataReader rdr = cmd.ExecuteReader(); OrganizationalUnitView organisationalUnitView = new OrganizationalUnitView(); if (rdr.Read()) { organisationalUnitView.Id = Convert.ToInt32(rdr["Id"]); organisationalUnitView.Title = Convert.ToString(rdr["Title"]); organisationalUnitView.Description = Convert.ToString(rdr["Description"]); organisationalUnitView.OrganizationaUnitGroup = Convert.ToString(rdr["OrganizationaUnitGroup"]); organisationalUnitView.Status = (StatusEnum)Convert.ToInt32(rdr["Status"]); } return(organisationalUnitView); } catch (Exception) { throw; } finally { conn.Close(); cmd.Dispose(); conn.Dispose(); } }
public void Insert(OrganizationalUnitEntity t) { throw new NotImplementedException(); }