public static string loadPendingRequests() { User user = (User)HttpContext.Current.Session["user"]; if (user == null) { return(null); } int empId = user.id; //-------------------------------------------------------------- JavaScriptSerializer js = new JavaScriptSerializer(); RequisitionController requisitionController = new RequisitionController(); List <Requisition> requisition_entities = requisitionController.actionGetPendingRequisitionsByUserID(empId); List <RequisitionModel> model = new List <RequisitionModel>(); StationeryController stationeryController = new StationeryController(); List <StationaryRequests> stationeryRequests = new List <StationaryRequests>(); int counter = 1; foreach (Requisition r in requisition_entities) { StationaryRequests stationaryRequests = new StationaryRequests(); stationaryRequests.Quantity = r.quantity; stationaryRequests.SNo = counter; stationaryRequests.StrationeryName = stationeryController.actionGetStationeryByID(r.stationery).stationery_name; stationaryRequests.RequestedDate = r.datetime_requested.ToString("MMMM dd, yyyy"); stationeryRequests.Add(stationaryRequests); counter++; } return(js.Serialize(stationeryRequests)); }//loadPendingRequests
public string loadAllPendingRequisitions(String accessToken) { OAuthController oAuth = new OAuthController(); User user = oAuth.actionGetUserByToken(accessToken); RequisitionController requisitionController = new RequisitionController(); List <Requisition> requisition_entities = requisitionController.actionGetPendingRequisitionsByUserID(user.id); List <RequisitionModel> model = new List <RequisitionModel>(); StationeryController stationeryController = new StationeryController(); List <StationaryRequests> stationeryRequests = new List <StationaryRequests>(); int counter = 1; foreach (Requisition r in requisition_entities) { StationaryRequests stationaryRequests = new StationaryRequests(); stationaryRequests.Quantity = r.quantity; stationaryRequests.SNo = counter; stationaryRequests.StationaryName = stationeryController.actionGetStationeryByID(r.stationery).stationery_name; stationaryRequests.RequestedDate = r.datetime_requested.ToString(); stationeryRequests.Add(stationaryRequests); counter++; } return(JsonConvert.SerializeObject(stationeryRequests)); }
public static string loadRejectedRequests() { User user = (User)HttpContext.Current.Session["user"]; if (user == null) { return(null); } int empId = user.id; //-------------------------------------------------------------- JavaScriptSerializer js = new JavaScriptSerializer(); RequisitionController requisitionController = new RequisitionController(); // hard coded user id = 6 // List<Requisition> requisition_entities =requisitionController.actionGetPendingRequisitionsByUserID(6); List <Requisition> requisition_entities = requisitionController.actionGetRejectedRequisitionsByUserID(empId); List <RequisitionModel> model = new List <RequisitionModel>(); StationeryController stationeryController = new StationeryController(); List <StationaryRequests> stationeryRequests = new List <StationaryRequests>(); foreach (Requisition r in requisition_entities) { StationaryRequests stationaryRequests = new StationaryRequests(); stationaryRequests.Quantity = r.quantity; stationaryRequests.StrationeryName = stationeryController.actionGetStationeryByID(r.stationery).stationery_name; stationaryRequests.RequestedDate = r.datetime_requested.ToString("MMMM dd, yyyy"); stationaryRequests.RejectReason = r.reject_remark; stationeryRequests.Add(stationaryRequests); } // System.Diagnostics.Debug.WriteLine("check @@@@@@@@@@@@ Rejected:" + js.Serialize(stationeryRequests)); return(js.Serialize(stationeryRequests)); } //loadDistributedRequests
protected void Page_Load(object sender, EventArgs e) { User suser = (User)Session["user"]; if (suser == null || suser.user_type != 4) { Response.Redirect("~/Login.aspx"); } SupplierController suppliercontroller = new SupplierController(); StationeryController stationerycontroller = new StationeryController(); if (int.TryParse(Request.QueryString["id"], out stationery_id)) { stationery_id = Convert.ToInt16(Request.QueryString["id"].ToString()); if (stationery_id < 1) { Response.Redirect("~/StoreClerk/InventoryStatus.aspx"); } if (!Page.IsPostBack) { User user = (User)Session["user"]; Stationery stationery = stationerycontroller.actionGetStationeryByID(stationery_id); //Supplier supplier = suppliercontroller.actionGetSuppierByID(Convert.ToInt32(stationery.first_supplier)); ui_from_textbox.Text = user.email; ui_to_dropdown.DataSource = stationerycontroller.actionGetStationeryViews(); ui_to_dropdown.DataSource = stationerycontroller.actionGetSuppliersOfAStationery(stationery.id); ui_to_dropdown.DataTextField = "supplier_name"; ui_to_dropdown.DataValueField = "id"; ui_to_dropdown.DataBind(); ui_subject_textbox.Text = "Purchase Order from Logic University."; ui_message_textbox.Text = "<p>Hello" + "" + ",</p>" + "<p>I would like to order the following item for our store. Please kindly proceed.</p>" + "<p><b>Stationery Name : " + stationery.stationery_name + "<br />" + "Quantity : " + stationery.reorder_quantity + "</b></p>" + "<p>Thank you,<br /> " + user.firstname + " " + user.lastname + " " + "(Logic University)</p>"; //+ stationery.stationery_name + stationery.category.ToString() + stationery.reorder_quantity.ToString()+""+"Regards, Logic University"; } } }
protected void Page_Load(object sender, EventArgs e) { ui_content_title_label.Text = "Stock Card"; Session["data:stock_card:stationery_id"] = null; StationeryController stationeryController = new StationeryController(); SupplierController supplierController = new SupplierController(); int stationery_id; if (int.TryParse(Request.QueryString["id"], out stationery_id)) { stationery_id = Convert.ToInt16(Request.QueryString["id"].ToString()); Session["data:stock_card:stationery_id"] = stationery_id; if (!(stationery_id > 0)) { } if (!Page.IsPostBack) { Stationery stationery = stationeryController.actionGetStationeryByID(stationery_id); ui_stationery_code_label.Text = stationery.code.ToString(); ui_stationery_name_label.Text = stationery.stationery_name.ToString(); ui_stationery_bin_label.Text = stationery.bin.ToString(); ui_stationery_uom_label.Text = stationery.unit_of_measure.ToString(); ui_stationery_supplier1_label.Text = supplierController.actionGetSuppierByID(Convert.ToInt16(stationery.first_supplier)).supplier_name.ToString(); ui_stationery_supplier2_label.Text = supplierController.actionGetSuppierByID(Convert.ToInt16(stationery.second_supplier)).supplier_name.ToString(); ui_stationery_supplier3_label.Text = supplierController.actionGetSuppierByID(Convert.ToInt16(stationery.third_supplier)).supplier_name.ToString(); ui_seationerysearch_box.Text = stationery.stationery_name.ToString(); StockTransactionController stockContorller = new StockTransactionController(); //ui_stockcard_gridview.DataSource = new StockTransactionController().actionGetStockTransactionByStationeryId(2); //ui_stockcard_gridview.DataBind(); } else { } } else { ui_stationeryinfo_panel.CssClass = "hide"; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { StationeryController stationeryController = new StationeryController(); List <Supplier> suppliers = new SupplierController().actionGetSuppliers(); int stationery_id; if (int.TryParse(Request.QueryString["id"], out stationery_id)) { stationery_id = Convert.ToInt16(Request.QueryString["id"].ToString()); if (stationery_id < 1) { Response.Redirect("~/m/DepartmentEmplyoee/Stationeries.aspx"); } if (!Page.IsPostBack) { Stationery stationery = stationeryController.actionGetStationeryByID(stationery_id); StationeryCategory category = stationeryController.actionGetStationeryCategoryByID(stationery.category); ui_stationery_name.Text = stationery.stationery_name; ui_category.Text = category.category_name; ui_id_hidden.Value = stationery.id.ToString(); ui_uom.Text = stationery.unit_of_measure; ui_price.Text = stationery.price.ToString(); ui_total.Text = stationery.price.ToString(); ui_price_hidden_forjscalculation.Value = stationery.price.ToString(); } } else { } } }
protected void Page_Load(object sender, EventArgs e) { StationeryController stationeryController = new StationeryController(); List <Supplier> suppliers = new SupplierController().actionGetSuppliers(); int stationery_id; if (int.TryParse(Request.QueryString["id"], out stationery_id)) { stationery_id = Convert.ToInt16(Request.QueryString["id"].ToString()); if (stationery_id < 1) { Response.Redirect("~/StoreClerk/StationeryList.aspx"); } if (!Page.IsPostBack) { Stationery stationery = stationeryController.actionGetStationeryByID(stationery_id); ui_id_hiddenfield.Value = stationery.id.ToString(); ui_code_textbox.Text = stationery.code.ToString(); ui_name_textbox.Text = stationery.stationery_name; ui_category_dropdown.DataSource = stationeryController.actionGetStationeryCategories(); ui_category_dropdown.DataTextField = "category_name"; ui_category_dropdown.DataValueField = "id"; ui_category_dropdown.DataBind(); ui_category_dropdown.SelectedValue = stationery.category.ToString(); ui_price_textbox.Text = stationery.price.ToString(); ui_reorderlevel_textbox.Text = stationery.reorder_level.ToString();; ui_reorderquantity_textbox.Text = stationery.reorder_quantity.ToString(); ui_quantityinstock_label.Text = stationery.quantity_in_stock.ToString(); ui_pendingquantity_label.Text = stationery.pending_quantity_to_distribute.ToString(); ui_uom_textbox.Text = stationery.unit_of_measure.ToString(); ui_binnum_textbox.Text = stationery.bin.ToString(); ui_firstsupplier_dropdown.DataSource = suppliers; ui_secondsupplier_dropdown.DataSource = suppliers; ui_thirdsupplier_dropdown.DataSource = suppliers; ui_firstsupplier_dropdown.DataTextField = "supplier_name"; ui_firstsupplier_dropdown.DataValueField = "id"; ui_secondsupplier_dropdown.DataTextField = "supplier_name"; ui_secondsupplier_dropdown.DataValueField = "id"; ui_thirdsupplier_dropdown.DataTextField = "supplier_name"; ui_thirdsupplier_dropdown.DataValueField = "id"; ui_firstsupplier_dropdown.DataBind(); ui_secondsupplier_dropdown.DataBind(); ui_thirdsupplier_dropdown.DataBind(); ui_firstsupplier_dropdown.SelectedValue = stationery.first_supplier.ToString(); ui_secondsupplier_dropdown.SelectedValue = stationery.second_supplier.ToString(); ui_thirdsupplier_dropdown.SelectedValue = stationery.third_supplier.ToString(); ui_content_title_label.Text = stationery.stationery_name.ToString(); } } else { String tmp_s1 = ui_firstsupplier_dropdown.SelectedValue; String tmp_s2 = ui_secondsupplier_dropdown.SelectedValue; String tmp_s3 = ui_thirdsupplier_dropdown.SelectedValue; String tmp_cate = ui_category_dropdown.SelectedValue; ui_category_dropdown.DataSource = stationeryController.actionGetStationeryCategories(); ui_category_dropdown.DataTextField = "category_name"; ui_category_dropdown.DataValueField = "id"; ui_category_dropdown.DataBind(); ui_firstsupplier_dropdown.DataSource = suppliers; ui_secondsupplier_dropdown.DataSource = suppliers; ui_thirdsupplier_dropdown.DataSource = suppliers; ui_firstsupplier_dropdown.DataTextField = "supplier_name"; ui_firstsupplier_dropdown.DataValueField = "id"; ui_secondsupplier_dropdown.DataTextField = "supplier_name"; ui_secondsupplier_dropdown.DataValueField = "id"; ui_thirdsupplier_dropdown.DataTextField = "supplier_name"; ui_thirdsupplier_dropdown.DataValueField = "id"; ui_firstsupplier_dropdown.DataBind(); ui_secondsupplier_dropdown.DataBind(); ui_thirdsupplier_dropdown.DataBind(); ui_category_dropdown.SelectedValue = tmp_cate; ui_firstsupplier_dropdown.SelectedValue = tmp_s1; ui_secondsupplier_dropdown.SelectedValue = tmp_s2; ui_thirdsupplier_dropdown.SelectedValue = tmp_s3; } }
protected void ui_save_button_Click(object sender, EventArgs e) { StationeryController sationeryController = new StationeryController(); Stationery stationery = new Stationery(); int stationery_id; //getting hidden field id if (int.TryParse(ui_id_hiddenfield.Value, out stationery_id)) { stationery.id = Convert.ToInt32(ui_id_hiddenfield.Value); stationery = sationeryController.actionGetStationeryByID(stationery.id); } //fields validation if (String.IsNullOrEmpty(ui_code_textbox.Text) || String.IsNullOrEmpty(ui_name_textbox.Text) || String.IsNullOrEmpty(ui_reorderlevel_textbox.Text) || String.IsNullOrEmpty(ui_reorderquantity_textbox.Text) || String.IsNullOrEmpty(ui_uom_textbox.Text) || String.IsNullOrEmpty(ui_price_textbox.Text) ) { 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; //String idstring = (supplier.id > 0) ? ("?id="+supplier.id) : (""); //Response.Redirect("~/StoreClerk/SupplierDetail.aspx"+idstring); } try { stationery.reorder_level = Convert.ToInt32(ui_reorderlevel_textbox.Text); stationery.reorder_quantity = Convert.ToInt32(ui_reorderquantity_textbox.Text); stationery.price = Convert.ToDouble(ui_price_textbox.Text); } catch (Exception ex) { Response.Cookies.Add(new HttpCookie("flash_message", "Price Reorder Level and Reorder Quantity only allow numbers.") { Path = "/" }); Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-error") { Path = "/" }); return; } //setting up object //setting up object stationery.code = ui_code_textbox.Text; stationery.stationery_name = ui_name_textbox.Text; stationery.category = Convert.ToInt32(ui_category_dropdown.SelectedValue); stationery.reorder_level = Convert.ToInt32(ui_reorderlevel_textbox.Text); stationery.reorder_quantity = Convert.ToInt32(ui_reorderquantity_textbox.Text); stationery.unit_of_measure = ui_uom_textbox.Text; stationery.bin = ui_binnum_textbox.Text; //stationery.quantity_in_stock = Convert.ToInt32(ui_quantityinstock_label.Text); //stationery.pending_quantity_to_distribute = Convert.ToInt32(ui_pendingquantity_label.Text); if (Page.IsPostBack) { } stationery.first_supplier = Convert.ToInt32(ui_firstsupplier_dropdown.SelectedItem.Value); stationery.second_supplier = Convert.ToInt32(ui_secondsupplier_dropdown.SelectedItem.Value); stationery.third_supplier = Convert.ToInt32(ui_thirdsupplier_dropdown.SelectedItem.Value); //stationery.first_supplier = 5; //stationery.second_supplier = 4; //stationery.third_supplier = 1; //updating db; Message message; if (stationery.id > 0) { message = sationeryController.actionUpdateStationery(stationery); } else { stationery.quantity_in_stock = 0; stationery.pending_quantity_to_distribute = 0; message = sationeryController.actionCreateStationery(stationery); } //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/StatoneryDetail.aspx?id=" + stationery.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/StatoneryDetail.aspx?id=" + stationery.id); } }