// Fill the page with data private void PopulateControls() { // Retrieve DepartmentID from the query string string departmentId = Request.QueryString["DepartmentID"]; // Retrieve CategoryID from the query string string categoryId = Request.QueryString["CategoryID"]; // If browsing a category... if (categoryId != null) { // Retrieve category details and display them CategoryDetails cd = CatalogBLO.GetCategoryDetails(categoryId); catalogTitleLabel.Text = cd.Name; catalogDescriptionLabel.Text = cd.Description; // Set the title of the page this.Title = ShopConfiguration.SiteName + " : Category : " + cd.Name; } // If browsing a department... else if (departmentId != null) { // Retrieve department details and display them DepartmentDetails dd = CatalogBLO.GetDepartmentDetails(departmentId); catalogTitleLabel.Text = dd.Name; catalogDescriptionLabel.Text = dd.Description; // Set the title of the page this.Title = ShopConfiguration.SiteName + " : Department : " + dd.Name; } }
// get department details public static DepartmentDetails GetDepartmentDetails(string departmentId) { // get a configured DbCommand object DbCommand comm = GenericDataAccess.CreateCommand(); // set the stored procedure name comm.CommandText = "CatalogGetDepartmentDetails"; // create a new parameter DbParameter param = comm.CreateParameter(); param.ParameterName = "@DepartmentID"; param.Value = departmentId; param.DbType = DbType.Int32; comm.Parameters.Add(param); // execute the stored procedure DataTable table = GenericDataAccess.ExecuteSelectCommand(comm); // wrap retrieved data into a DepartmentDetails object DepartmentDetails details = new DepartmentDetails(); if (table.Rows.Count > 0) { details.Name = table.Rows[0]["Name"].ToString(); details.Description = table.Rows[0]["Description"].ToString(); } // return department details return(details); }
// Fill the page with data private void PopulateControls() { // Retrieve DepartmentID from the query string string departmentId = Request.QueryString["DepartmentID"]; // Retrieve CategoryID from the query string string categoryId = Request.QueryString["CategoryID"]; // If browsing a category... if (categoryId != null) { // Retrieve category and department details and display them CategoryDetails cd = CatalogAccess.GetCategoryDetails(categoryId); catalogTitleLabel.Text = HttpUtility.HtmlEncode(cd.Name); DepartmentDetails dd = CatalogAccess.GetDepartmentDetails(departmentId); catalogDescriptionLabel.Text = HttpUtility.HtmlEncode(cd.Description); // Set the title of the page this.Title = HttpUtility.HtmlEncode(BalloonShopConfiguration.SiteName + ": " + dd.Name + ": " + cd.Name); } // If browsing a department... else if (departmentId != null) { // Retrieve department details and display them DepartmentDetails dd = CatalogAccess.GetDepartmentDetails(departmentId); catalogTitleLabel.Text = HttpUtility.HtmlEncode(dd.Name); catalogDescriptionLabel.Text = HttpUtility.HtmlEncode(dd.Description); // Set the title of the page this.Title = HttpUtility.HtmlEncode(BalloonShopConfiguration.SiteName + ": " + dd.Name); } }
/// <summary> /// Displays the details of the department including the testimonials for the department /// </summary> /// <param name="Id">Id of the department</param> /// <returns> /// If successfull in fetching the data from the api controller, returns a "DepartmentDetails" View Model /// which contains information on the details of the department and the testimonials of the department. /// </returns> /// <example> /// GET: Department/DetailsofDepartment/5 /// </example> public ActionResult DetailsofDepartment(int Id) { DepartmentDetails departmentdetails = new DepartmentDetails(); departmentdetails.isadmin = User.IsInRole("admin"); departmentdetails.isloggedinUser = User.IsInRole("user"); departmentdetails.userid = User.Identity.GetUserId(); string url = "DepartmentData/FindDepartment/" + Id; HttpResponseMessage response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { DepartmentsDto department = response.Content.ReadAsAsync <DepartmentsDto>().Result; departmentdetails.DepartmentDto = department; url = "DepartmentData/FindTestimonialsForDepartment/" + Id; response = client.GetAsync(url).Result; IEnumerable <TestimonialDto> testimonials = response.Content.ReadAsAsync <IEnumerable <TestimonialDto> >().Result; departmentdetails.Testimonials = testimonials; url = "DepartmentData/FindJobPostingsforDepartment/" + Id; response = client.GetAsync(url).Result; IEnumerable <JobPostingsModel> jobPostings = response.Content.ReadAsAsync <IEnumerable <JobPostingsModel> >().Result; departmentdetails.JobPostings = jobPostings; return(View(departmentdetails)); } else { return(RedirectToAction("Error")); } }
public static DepartmentDetails Instance() { if (sForm == null) { sForm = new DepartmentDetails(); } return(sForm); }
/// <summary> /// Updates an existing department /// </summary> public static bool UpdateDepartment(int id, string title, int importance, string description, string imageUrl) { DepartmentDetails record = new DepartmentDetails(id, DateTime.Now, "", title, importance, description, imageUrl); bool ret = SiteProvider.Store.UpdateDepartment(record); BizObject.PurgeCacheItems("store_department"); return(ret); }
/// <summary> /// Creates a new department /// </summary> public static int InsertDepartment(string title, int importance, string description, string imageUrl) { DepartmentDetails record = new DepartmentDetails(0, DateTime.Now, BizObject.CurrentUserName, title, importance, description, imageUrl); int ret = SiteProvider.Store.InsertDepartment(record); BizObject.PurgeCacheItems("store_department"); return(ret); }
/// <summary> /// Returns a Department object filled with the data taken from the input DepartmentDetails /// </summary> private static Department GetDepartmentFromDepartmentDetails(DepartmentDetails record) { if (record == null) { return(null); } else { return(new Department(record.ID, record.AddedDate, record.AddedBy, record.Title, record.Importance, record.Description, record.ImageUrl)); } }
private void SaveRecord() { Department clsDepartment = new Department(); DepartmentDetails clsDetails = new DepartmentDetails(); clsDetails.DepartmentID = Convert.ToInt16(lblDepartmentID.Text); clsDetails.DepartmentCode = txtDepartmentCode.Text; clsDetails.DepartmentName = txtDepartmentName.Text; clsDepartment.Update(clsDetails); clsDepartment.CommitAndDispose(); }
private void LoadRecord() { Int16 iID = Convert.ToInt16(Common.Decrypt(Request.QueryString["id"], Session.SessionID)); Department clsDepartment = new Department(); DepartmentDetails clsDetails = clsDepartment.Details(iID); clsDepartment.CommitAndDispose(); lblDepartmentID.Text = clsDetails.DepartmentID.ToString(); txtDepartmentCode.Text = clsDetails.DepartmentCode; txtDepartmentName.Text = clsDetails.DepartmentName; }
private Int32 SaveRecord() { Department clsDepartment = new Department(); DepartmentDetails clsDetails = new DepartmentDetails(); clsDetails.DepartmentCode = txtDepartmentCode.Text; clsDetails.DepartmentName = txtDepartmentName.Text; Int32 id = clsDepartment.Insert(clsDetails); clsDepartment.CommitAndDispose(); return(id); }
/// <summary> /// Updates a department /// </summary> public override bool UpdateDepartment(DepartmentDetails department) { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("tbh_Store_UpdateDepartment", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@DepartmentID", SqlDbType.Int).Value = department.ID; cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = department.Title; cmd.Parameters.Add("@Importance", SqlDbType.Int).Value = department.Importance; cmd.Parameters.Add("@ImageUrl", SqlDbType.NVarChar).Value = department.ImageUrl; cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value = department.Description; cn.Open(); int ret = ExecuteNonQuery(cmd); return(ret == 1); } }
public static string ToDepartment(string departmentId, string page) { // prepare department URL name DepartmentDetails d = CatalogAccess.GetDepartmentDetails(departmentId); string deptUrlName = PrepareUrlText(d.Name); // build department URL if (page == "1") { return(BuildAbsolute(String.Format("{0}-d{1}/", deptUrlName, departmentId))); } else { return(BuildAbsolute(String.Format("{0}-d{1}/Page={2}", deptUrlName, departmentId, page))); } }
protected void Page_Load(object sender, EventArgs e) { // Load the grid only the first time the page is loaded if (!Page.IsPostBack) { // Load the categories grid BindGrid(); // Get DepartmentID from the query string string departmentId = Request.QueryString["DepartmentID"]; // Obtain the department's name DepartmentDetails dd = CatalogAccess.GetDepartmentDetails(departmentId); string departmentName = dd.Name + "</b>"; // Link to department deptLink.Text = departmentName; deptLink.NavigateUrl = "AdminDepartments.aspx"; } }
protected void Page_Load(object sender, EventArgs e) { // Load the grid only the first time the page is loaded if (!Page.IsPostBack) { // Load the categories grid BindGrid(); // Get DepartmentID from the query string string departmentId = Request.QueryString["DepartmentID"]; // Obtain the department's name DepartmentDetails dd = CatalogBLO.GetDepartmentDetails(departmentId); string departmentName = dd.Name; // Set controls' properties statusLabel.ForeColor = System.Drawing.Color.Red; locationLabel.Text = "Displaying categories for department <b> " + departmentName + "</b>"; } }
/// <summary> /// Creates a new department /// </summary> public override int InsertDepartment(DepartmentDetails department) { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("tbh_Store_InsertDepartment", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = department.AddedDate; cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = department.AddedBy; cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = department.Title; cmd.Parameters.Add("@Importance", SqlDbType.Int).Value = department.Importance; cmd.Parameters.Add("@ImageUrl", SqlDbType.NVarChar).Value = department.ImageUrl; cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value = department.Description; cmd.Parameters.Add("@DepartmentID", SqlDbType.Int).Direction = ParameterDirection.Output; cn.Open(); int ret = ExecuteNonQuery(cmd); return((int)cmd.Parameters["@DepartmentID"].Value); } }
public static string ToCategory(string departmentId, string categoryId, string page) { // prepare department and category URL names DepartmentDetails d = CatalogAccess.GetDepartmentDetails(departmentId); string deptUrlName = PrepareUrlText(d.Name); CategoryDetails c = CatalogAccess.GetCategoryDetails(categoryId); string catUrlName = PrepareUrlText(c.Name); // build category URL if (page == "1") { return(BuildAbsolute(String.Format("{0}-d{1}/{2}-c{3}/", deptUrlName, departmentId, catUrlName, categoryId))); } else { return(BuildAbsolute(String.Format("{0}-d{1}/{2}-c{3}/Page-{4}/", deptUrlName, departmentId, catUrlName, categoryId, page))); } }
public ActionResult GetDataViewModel() { EmpDep objedt = new EmpDep(); EmployeeDetails objsiri = new EmployeeDetails(); objsiri.EmpId = 1111; objsiri.Empname = "siri"; objsiri.Empsalary = 100000; DepartmentDetails dt = new DepartmentDetails(); dt.DeptId = 1212; dt.DeptName = "Dotnet"; objedt.Emp = objsiri; objedt.Dept = dt; return(View(objedt)); }
public ActionResult GetMultipleDataViewModel() { List <EmployeeDetails> listempobj = new List <EmployeeDetails>(); List <DepartmentDetails> listdeptobj = new List <DepartmentDetails>(); EmpDeplist objedt = new EmpDeplist(); EmployeeDetails objsiri = new EmployeeDetails(); objsiri.EmpId = 1111; objsiri.Empname = "siri"; objsiri.Empsalary = 100000; EmployeeDetails objprasanna = new EmployeeDetails(); objprasanna.EmpId = 2222; objprasanna.Empname = "Prasanna"; objprasanna.Empsalary = 200000; DepartmentDetails dt = new DepartmentDetails(); dt.DeptId = 1212; dt.DeptName = "Dotnet"; DepartmentDetails dt1 = new DepartmentDetails(); dt1.DeptId = 1213; dt1.DeptName = "Java"; listempobj.Add(objsiri); listempobj.Add(objprasanna); listdeptobj.Add(dt); listdeptobj.Add(dt1); objedt.Emp = listempobj; objedt.Dept = listdeptobj; return(View(objedt)); }
public DepartmentDetails FindDepartmentById(string id) { DepartmentDetails dd = null; Department d = ids.SearchDepartmentByDeptId(id); if (d != null) { dd = new DepartmentDetails() { DeptId = d.DeptId, LocationId = d.LocationId, DeptName = d.DeptName, Contact_Name = d.Contact_Name, RepresentativeId = d.RepresentativeId.ToString(), HeadId = d.HeadId.ToString(), StoreClerkId = d.StoreClerkId.ToString(), TelephoneNo = d.TelephoneNo, Fax = d.Fax }; } return(dd); }
/// <summary> /// Displays the details of the department including the testimonials for the department /// </summary> /// <param name="Id">Id of the department</param> /// <returns> /// If successfull in fetching the data from the api controller, returns a "DepartmentDetails" View Model /// which contains information on the details of the department and the testimonials of the department. /// </returns> /// <example> /// GET: Department/DetailsofDepartment/5 /// </example> public ActionResult DetailsofDepartment(int Id) { DepartmentDetails departmentdetails = new DepartmentDetails(); string url = "DepartmentData/FindDepartment/" + Id; HttpResponseMessage response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { DepartmentsDto department = response.Content.ReadAsAsync <DepartmentsDto>().Result; departmentdetails.DepartmentDto = department; url = "DepartmentData/FindTestimonialsForDepartment/" + Id; response = client.GetAsync(url).Result; IEnumerable <TestimonialDto> testimonials = response.Content.ReadAsAsync <IEnumerable <TestimonialDto> >().Result; departmentdetails.Testimonials = testimonials; return(View(departmentdetails)); } else { return(RedirectToAction("Error")); } }
/* * This method to add new team to the Db with given Details */ public int AddDepartment(DepartmentEmployeeDetailsDto toAddDepartment) { DepartmentDetails departmentData = new DepartmentDetails(); try { departmentData.DepartmentHeadName = toAddDepartment.DepartHeadName; departmentData.DepartmentDiscription = toAddDepartment.DepartmentDisc; departmentData.DepartmentName = toAddDepartment.DepartmentName; Context.DepartmentDetails.Add(departmentData); Context.SaveChanges(); } catch (SqlException sqlExp) { throw sqlExp; } catch (NullReferenceException expNull) { throw expNull; } return(departmentData.DepartmentId); }
// get department details public static DepartmentDetails GetDepartmentDetails(string departmentId) { // get a configured DbCommand object DbCommand comm = GenericDataAccess.CreateCommand(); // set the stored procedure name comm.CommandText = "CatalogGetDepartmentDetails"; // create a new parameter DbParameter param = comm.CreateParameter(); param.ParameterName = "@DepartmentID"; param.Value = departmentId; param.DbType = DbType.Int32; comm.Parameters.Add(param); // execute the stored procedure DataTable table = GenericDataAccess.ExecuteSelectCommand(comm); // wrap retrieved data into a DepartmentDetails object DepartmentDetails details = new DepartmentDetails(); if (table.Rows.Count > 0) { details.Name = table.Rows[0]["Name"].ToString(); details.Description = table.Rows[0]["Description"].ToString(); } // return department details return details; }
// get department details public static DepartmentDetails GetDepartmentDetails(string departmentId) { // get a configured OracleCommand object OracleCommand comm = GenericDataAccess.CreateCommand(); // set the stored procedure name comm.CommandText = "CatalogGetDepartmentDetails"; // create a new parameter OracleParameter param = comm.Parameters.Add("dept_ID", OracleDbType.Int32); param.Direction = ParameterDirection.Input; param.Value = Int32.Parse(departmentId); comm.CommandType = CommandType.StoredProcedure; OracleParameter p2 = comm.Parameters.Add("cat_out", OracleDbType.RefCursor); p2.Direction = ParameterDirection.Output; // execute the stored procedure DataTable table = GenericDataAccess.ExecuteSelectCommand(comm); // wrap retrieved data into a DepartmentDetails object DepartmentDetails details = new DepartmentDetails(); if (table.Rows.Count > 0) { details.Name = table.Rows[0]["Name"].ToString(); details.Description = table.Rows[0]["Description"].ToString(); } // return department details return details; }
/// <summary> /// Method to save data /// </summary> /// <param name="departmentDetails"></param> public void SaveDetails(DepartmentDetails departmentDetails) { _departmentDetails.SaveDetails(departmentDetails); }
public static DepartmentDetails GetDepartmentDetails(string departmentId) { DbCommand comm = GenericDataAccess.CreateCommand(); comm.CommandText = "CatalogGetDepartmentDetails"; DbParameter param = comm.CreateParameter(); param.ParameterName = "@DepartmentID"; param.Value = departmentId; param.DbType = DbType.Int32; comm.Parameters.Add(param); DataTable table = GenericDataAccess.ExecuteSelectCommand(comm); DepartmentDetails details = new DepartmentDetails(); if (table.Rows.Count > 0) { DataRow dr = table.Rows[0]; details.Name = dr["Name"].ToString(); details.Description = dr["Description"].ToString(); } return details; }
/// <summary> /// Method to convert db object to view objects /// </summary> /// <param name="departmentDetails"></param> /// <param name="item"></param> /// <returns></returns> private DepartmentDetailsView GetViewObject(List <DepartmentDetails> departmentDetails, DepartmentDetails item) { return(new DepartmentDetailsView { Id = item.Id, CategoryName = _categoryBizManager.GetCategoryList()?.Where(x => x.Id == item.CategoryId)?.Select(x => x.CategoryName)?.FirstOrDefault(), Amount = item.Amount, Year = item.Year, CategoryId = item.CategoryId, YearOne = GetSumOfAmountBasedOnCategory(departmentDetails, item.CategoryId, (int)EnumYear.YearFour, true, false), YearTwo = GetSumOfAmountBasedOnCategory(departmentDetails, item.CategoryId, (int)EnumYear.YearFour, false, false), YearThree = GetSumOfAmountBasedOnCategory(departmentDetails, item.CategoryId, (int)EnumYear.YearFive, false, false), YearFour = GetSumOfAmountBasedOnCategory(departmentDetails, item.CategoryId, (int)EnumYear.YearSix, false, false), YearFive = GetSumOfAmountBasedOnCategory(departmentDetails, item.CategoryId, (int)EnumYear.YearSix, false, true), SumOfYearBefore2018 = GetSumOfAmountByYear(departmentDetails, (int)EnumYear.YearFour, true, false), SumOfYear2018 = GetSumOfAmountByYear(departmentDetails, (int)EnumYear.YearFour, false, false), SumOfYear2019 = GetSumOfAmountByYear(departmentDetails, (int)EnumYear.YearFive, false, false), SumOfYear2020 = GetSumOfAmountByYear(departmentDetails, (int)EnumYear.YearSix, false, false), SumOfYearAfter2020 = GetSumOfAmountByYear(departmentDetails, (int)EnumYear.YearSix, false, true), }); }
/// <summary> /// Creates a new department /// </summary> public override int InsertDepartment(DepartmentDetails department) { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("tbh_Store_InsertDepartment", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = department.AddedDate; cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = department.AddedBy; cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = department.Title; cmd.Parameters.Add("@Importance", SqlDbType.Int).Value = department.Importance; cmd.Parameters.Add("@ImageUrl", SqlDbType.NVarChar).Value = department.ImageUrl; cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value = department.Description; cmd.Parameters.Add("@DepartmentID", SqlDbType.Int).Direction = ParameterDirection.Output; cn.Open(); int ret = ExecuteNonQuery(cmd); return (int)cmd.Parameters["@DepartmentID"].Value; } }
/// <summary> /// Updates a department /// </summary> public override bool UpdateDepartment(DepartmentDetails department) { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("tbh_Store_UpdateDepartment", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@DepartmentID", SqlDbType.Int).Value = department.ID; cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = department.Title; cmd.Parameters.Add("@Importance", SqlDbType.Int).Value = department.Importance; cmd.Parameters.Add("@ImageUrl", SqlDbType.NVarChar).Value = department.ImageUrl; cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value = department.Description; cn.Open(); int ret = ExecuteNonQuery(cmd); return (ret == 1); } }
public ErrCode SaveDepartment(DepartmentDetails _department, out int department_id) { ErrCode err = SiteProvider.CurrentProvider.SaveDepartment(_department, out department_id); return err; }
/// <summary> /// Method to save the data to db /// </summary> /// <param name="departmentDetails"></param> public void SaveDetails(DepartmentDetails departmentDetails) { _efDbContext.DepartmentDetails.Add(departmentDetails); _efDbContext.SaveChanges(); }