protected void btnDistribute_Click(object sender, EventArgs e) { foreach (GridViewRow row in GridView1.Rows) { if (checkValidation(row)) { CheckBox cb = (CheckBox)row.FindControl("selector"); if (cb.Checked) { deptId = Convert.ToInt32(row.Cells[2].Text); stationeryId = Convert.ToInt32(row.Cells[3].Text); new DisbursementController().actionUpdateToDisbursement(deptId, stationeryId); refreshNeed = true; } } } Department department = new DepartmentController().actionGetDepartmentByID(deptId); User head = new UserController().actionGetUserByID(Convert.ToInt32(department.department_head)); String email_title = "Stationery Requesitions Update Information."; String email_body = "<p>Hello " + head.firstname + " " + head.lastname + ",</p>" + "<p>The stationeries requested from "+ department.department_name+ " are distributed " + "to " + department.representative_name + ".</p>" + "<br />Thank you,<br/> Logic University.<p>This is system generated mail. Please do not reply.</p>"; Helper.sendMail(head.email, "*****@*****.**", email_title, email_body); new SMSController().sendSMS(head.phone_number, "Requested stationeries from " + department.department_name + " are distributed."); showSuccess(refreshNeed, "Successfully Recorded Distributed Items."); }
public static string GetAllDisbursements(object jsonParam) { User user = (User)HttpContext.Current.Session["user"]; if (user == null) { return null; } Dictionary<string, Dictionary<string, double>> reportDict; String valuesStr = jsonParam.ToString(); String[] values = valuesStr.Split(','); String quantityType = values[values.Length - 1]; String[] monthYearValues = new String[values.Length - 1]; for (int i = 0; i < values.Length - 1; i++) { monthYearValues[i] = values[i]; } String departmentName = new DepartmentController().actionGetDepartmentByID(Convert.ToInt32(user.department)).department_name; JavaScriptSerializer js = new JavaScriptSerializer(); reportDict = rc.getAllDisbursementsByNameAndDates(departmentName, monthYearValues,quantityType); return js.Serialize(reportDict); }
protected void Page_Load(object sender, EventArgs e) { DepartmentController departmentController = new DepartmentController(); CollectionPointController collectionPointController = new CollectionPointController(); int department_id; if (int.TryParse(Request.QueryString["id"], out department_id)) { department_id = Convert.ToInt16(Request.QueryString["id"].ToString()); if (department_id < 1) { Response.Redirect("~/StoreClerk/DepartmentList.aspx"); } Department department = departmentController.actionGetDepartmentByID(department_id); if (!Page.IsPostBack) { ui_id_hiddenfield.Value = department.id.ToString(); ui_deptcode_textbox.Text = department.code; ui_deptname_textbox.Text = department.department_name; ui_contactname_textbox.Text = department.contact_name; ui_phone_textbox.Text = department.phone; ui_representativename_textbox.Text = department.representative_name; ui_depthead_dropdown.DataSource = departmentController.actionGetUsersOfADepartment(department_id); ui_depthead_dropdown.DataTextField = "username"; ui_depthead_dropdown.DataValueField = "id"; ui_depthead_dropdown.DataBind(); ui_depthead_dropdown.SelectedValue = department.department_head.ToString(); ui_collectionpoint_dropdown.DataSource = collectionPointController.actionGetCollectionPoints(); ui_collectionpoint_dropdown.DataTextField = "name"; ui_collectionpoint_dropdown.DataValueField = "id"; ui_collectionpoint_dropdown.DataBind(); ui_collectionpoint_dropdown.SelectedValue = department.collection_point.ToString(); } } else { String tmp_depthead = ui_depthead_dropdown.SelectedValue; String tmp_colpoint = ui_collectionpoint_dropdown.SelectedValue; ui_depthead_dropdown.DataSource = departmentController.actionGetUsersOfADepartment(department_id); ui_depthead_dropdown.DataTextField = "username"; ui_depthead_dropdown.DataValueField = "id"; ui_depthead_dropdown.DataBind(); ui_collectionpoint_dropdown.DataSource = collectionPointController.actionGetCollectionPoints(); ui_collectionpoint_dropdown.DataTextField = "name"; ui_collectionpoint_dropdown.DataValueField = "id"; ui_collectionpoint_dropdown.DataBind(); ui_depthead_dropdown.SelectedValue = tmp_depthead; ui_collectionpoint_dropdown.SelectedValue = tmp_colpoint; } }
protected void Page_Load(object sender, EventArgs e) { int user_id; if (int.TryParse(Request.QueryString["id"], out user_id)) { user_id = Convert.ToInt16(Request.QueryString["id"].ToString()); if (user_id < 1) { Response.Redirect("~/StoreClerk/UserList.aspx"); } if (!Page.IsPostBack) { UserController userController = new UserController(); UserView user = userController.actionGetUserViewByUserID(user_id); ui_id_hiddenfield.Value = user.id.ToString(); ui_username_textbox.Text = user.username; ui_password_textbox.Text = ""; ui_firstname_textbox.Text = user.firstname; ui_lastname_textbox.Text = user.lastname; ui_email_textbox.Text = user.email; ui_phonenumber_textbox.Text = user.phone_number; ui_usertype_label.Text = user.type; List<Department> departments = new DepartmentController().actionGetDepartments(); ui_department_dropdown.DataSource = departments; ui_department_dropdown.DataTextField = "department_name"; ui_department_dropdown.DataValueField = "id"; if (user.department > 0) { ui_department_dropdown.SelectedValue = user.department.ToString(); } ui_department_dropdown.DataBind(); ui_content_title_label.Text = user.firstname + " " + user.lastname; } } else { String tmp_dept = ui_department_dropdown.SelectedValue; ui_usertype_label.Text = "(Default user type will be emplyoee)"; List<Department> departments = new DepartmentController().actionGetDepartments(); ui_department_dropdown.DataSource = departments; ui_department_dropdown.DataTextField = "department_name"; ui_department_dropdown.DataValueField = "id"; ui_department_dropdown.DataBind(); ui_department_dropdown.SelectedValue = tmp_dept; } }
public void getJSONByDepartment(HttpContext context) { List<MDepartment> mList = new List<MDepartment>(); List<GetDepartmentForFulfillment> list = new DepartmentController().actionGetDepartmentForFulfillment(); foreach (GetDepartmentForFulfillment i in list) { mList.Add(new MDepartment(i.id,i.department_name,i.representative_name,i.name)); } context.Response.Write(JsonConvert.SerializeObject(mList)); context.Response.End(); }
protected void btnSave_Click(object sender, EventArgs e) { int department_id = Convert.ToInt32(((User)Session["user"]).department); Message msg = new DepartmentController().actionChangeCollectionPointAndReptName(department_id, Convert.ToInt32(ddlCollectionPoint.SelectedValue), txtRepresentative.Text); if (msg.condition) { Response.Cookies.Add(new HttpCookie("flash_message", "Successfully Saved.") { Path = "/" }); Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-success") { Path = "/" }); Response.Redirect("~/DepartmentHead/Preference.aspx?id=" + department_id); } else { Response.Cookies.Add(new HttpCookie("flash_message", msg.message) { Path = "/" }); Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-error") { Path = "/" }); Response.Redirect(Request.RawUrl); } //lblStatus.Visible = true; //lblStatus.Text = "Successfully Updated"; }
protected void Page_Load(object sender, EventArgs e) { User user = (User)Session["user"]; if (user == null || ((user.user_type != 3) && user.user_type != 2)) { Response.Redirect("~/Login.aspx"); } UserController userController = new UserController(); User dUser = userController.actionGetUserByID(user.id); if (!IsPostBack) { Department department = new DepartmentController().actionGetDepartmentByID(Convert.ToInt32(dUser.department)); ddlCollectionPoint.DataSource = new CollectionPointController().actionGetCollectionPoints(); ddlCollectionPoint.DataValueField = "id"; ddlCollectionPoint.DataTextField = "name"; ddlCollectionPoint.DataBind(); ddlCollectionPoint.Items.FindByValue(department.collection_point.ToString()).Selected = true; txtRepresentative.Text = department.representative_name; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.QueryString["id"].ToString() != string.Empty) { deptId = Convert.ToInt32(Request.QueryString["id"].ToString()); GetDepartmentForFulfillment d = new DepartmentController().actionGetDepartmentForFulfillment(deptId); ui_content_title_label.Text = "Requistions from "+d.department_name; //lblDeptName.Text = d.department_name; lblCollectionPoint.Text = d.name; lblReptName.Text = d.representative_name; } FulfillmentController fc = new FulfillmentController(); BindGridView(); } }
protected void ui_save_button_Click(object sender, EventArgs e) { DepartmentController departmentController = new DepartmentController(); Department department = new Department(); int department_id; //getting hidden field id if (int.TryParse(ui_id_hiddenfield.Value, out department_id)) { department.id = Convert.ToInt32(ui_id_hiddenfield.Value); } if (department.id > 0) { department = departmentController.actionGetDepartmentByID(department.id); } //fields validation if (String.IsNullOrEmpty(ui_deptcode_textbox.Text) || String.IsNullOrEmpty(ui_deptname_textbox.Text) || (Convert.ToInt32(ui_collectionpoint_dropdown.SelectedValue) < 1)) { Response.Cookies.Add(new HttpCookie("flash_message", "Field(s) marked with * can't be empty.") { Path = "/" }); Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-error") { Path = "/" }); return; } //setting up object //user.username = ui_username_textbox.Text; department.code = ui_deptcode_textbox.Text; department.department_name = ui_deptname_textbox.Text; department.contact_name = ui_contactname_textbox.Text; department.phone = ui_phone_textbox.Text; department.representative_name = ui_representativename_textbox.Text; try { int head_id = Convert.ToInt32(ui_depthead_dropdown.SelectedValue); if (head_id > 0) { department.department_head = head_id; } } catch (Exception ex){ department.department_head = null; } int collection_point = Convert.ToInt32(ui_collectionpoint_dropdown.SelectedValue); if (collection_point > 0) { department.collection_point = collection_point; } //updating db; Message message; if (department.id > 0) { message = departmentController.actionUpdateDepartment(department); } else { message = departmentController.actionCreateDepartment(department); } //redirecting if (message.condition) { Response.Cookies.Add(new HttpCookie("flash_message", "Successfully Saved.") { Path = "/" }); Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-success") { Path = "/" }); Response.Redirect("~/StoreClerk/DepartmentDetails.aspx?id=" + department.id); } else { Response.Cookies.Add(new HttpCookie("flash_message", message.message) { Path = "/" }); Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-error") { Path = "/" }); Response.Redirect("~/StoreClerk/DepartmentDetails.aspx?id=" + department.id); } }