protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LUUser user = (LUUser)Session["User"]; int requestorId = user.UserID; List <Requisition> items = reqController.getRejectedRequisition(requestorId); DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[4] { new DataColumn("ReqID"), new DataColumn("ReqNumber"), new DataColumn("ReqDate"), new DataColumn("Remark") }); foreach (Requisition i in items) { DataRow r = dt.NewRow(); r["ReqID"] = i.ReqID; r["ReqNumber"] = i.ReqNumber; r["ReqDate"] = i.ReqDate.ToLongDateString(); r["Remark"] = i.Remark; dt.Rows.Add(r); } ViewState["dt"] = dt; gvRejectedRequests.DataSource = dt; gvRejectedRequests.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LUUser user = (LUUser)Session["User"]; int depId = user.DepartmentID.Value; List <Requisition> items = reqController.getRequisitionListHod(depId); DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[5] { new DataColumn("ReqID"), new DataColumn("ReqNumber"), new DataColumn("ReqDate"), new DataColumn("Status"), new DataColumn("Remark") }); foreach (Requisition i in items) { DataRow r = dt.NewRow(); r["ReqID"] = i.ReqID; r["ReqNumber"] = i.ReqNumber; r["ReqDate"] = i.ReqDate.ToLongDateString(); r["Status"] = i.Status; r["Remark"] = i.Remark; dt.Rows.Add(r); } gvRequestHistory.DataSource = dt; gvRequestHistory.DataBind(); } }
public void PersistPO(List <PurchaseOrderUtil> newPOUlist, POBatch batch, LUUser user) { Dictionary <PurchaseOrder, List <PurchaseOrderItems> > poitemsList = new Dictionary <PurchaseOrder, List <PurchaseOrderItems> >(); foreach (PurchaseOrderUtil npo in newPOUlist) { PurchaseOrder po = new PurchaseOrder(); po.PuchaseOrderNo = npo.PoNumber; po.OrderEmpID = user.UserID; po.OrderDate = npo.OrderDate; po.DeliveryAddress = "Store Address"; po.POStatus = PurchaseOrderStatus.Requested.ToString(); po.SupplierID = npo.Supplier.SupplierID; po.DONumber = ""; po.PORemark = npo.Remark; po.ExpectedDeliveryDate = Convert.ToDateTime(npo.ExpectedDeliveryDate); po.POBatchID = batch.POBatchID; PODao.db.PurchaseOrders.Add(po); PODao.db.SaveChanges(); poitemsList.Add(po, npo.Items); } PersistPoItems(poitemsList, user); }
public void SavePurchaseOrder(List <PurchaseOrderUtil> newPOUlist, LUUser user) { PurchaseOrderItemDao poitem = new PurchaseOrderItemDao(); try { POBatch batch = new POBatch(); batch.POBatchDate = DateTime.Now; batch.Printed = false; batch.GeneratedBy = user.UserID; POBatchDao.db.POBatches.Add(batch); POBatchDao.db.SaveChanges(); PersistPO(newPOUlist, batch, user); } catch (DbEntityValidationException ea) { foreach (var eve in ea.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } }
protected void Page_Load(object sender, EventArgs e) { LUUser user = (LUUser)Session["user"]; List <Requisition> req = new List <Requisition>(); req = new ApproveRejectReqController().getRequestedRequisitionHod(user.DepartmentID.Value); lblPendingApproval.Text = req.Count.ToString(); }
protected void DeleteRow(object sender, GridViewDeleteEventArgs e) { LUUser user = (LUUser)Session["User"]; int index = Convert.ToInt32(e.Keys[0]); new NotificationController().ChangeNotification(user.UserID, index, Util.NotificationStatus.Cleared); ShowNotifications(); }
private void ShowNotifications() { LUUser user = (LUUser)Session["User"]; notifications = new NotificationController().GetNotificationsByRoleCode(user.Role.RoleCode, user.DepartmentID.Value); lblNotCount.Text = lblNotShortMsg.Text = notifications.Count().ToString(); gvNots.DataSource = notifications; gvNots.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LUUser user = (LUUser)Session["User"]; int depId = user.DepartmentID.Value; gvRequestedRequisition.DataSource = reqController.getRequestedRequisitionHod(depId); gvRequestedRequisition.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { LUUser user = (LUUser)Session["user"]; List <Requisition> req = new List <Requisition>(); req = new CancelUpdateUnallocatedController().GetRequestedRequisitionListHod(user.DepartmentID.Value); lblAckReqs.Text = req.Count.ToString(); List <Requisition> recUnalo = new CancelUpdateUnallocatedController().GetApprovedRequisition(user.DepartmentID.Value); lblUpdateReqs.Text = recUnalo.Count.ToString(); }
public bool UpdateUserRole(int userId, string roleCode) { bool result = false; LUUser emp = db.LUUsers.Where(user => user.UserID == userId).FirstOrDefault(); emp.RoleID = db.Roles.Where(role => role.RoleCode == roleCode).FirstOrDefault().RoleID; if (db.SaveChanges() > 0) { result = true; } return(result); }
private void PopulateEmpList() { LUUser logUser = (LUUser)Session["user"]; List <LUUser> users = new UserController().GetUsersByDeptCode(logUser != null && logUser.Department != null ? logUser.Department.DepartmentID : 0); lstEmp.DataSource = users; lstEmp.DataBind(); if (users.Count > 0) { lstEmp.Items[0].Selected = true; } }
protected void btnSubmit_Click(object sender, EventArgs e) { LUUser user = (LUUser)Session["User"]; if (user == null) { throw new InvalidOperationException("User Is not valid"); } if (ViewState["items"] != null) { items = (List <CartItem>)ViewState["items"]; RequisitionItemDao dao = new RequisitionItemDao(); Requisition requisition = new Requisition(); requisition.ReqDate = System.DateTime.Now; requisition.ReqNumber = requisitionNum; //Todo requisition.Status = RequisitionStatus.Requested.ToString(); requisition.RequesterID = user.UserID; // Todo: need to change later once login up requisition.DepartmentID = user.DepartmentID.Value; // Todo: same requisition.RecieveByID = user.Department.HodID; //Todo: same requisition.Remark = tbRemarks.Text; dao.db.Requisitions.Add(requisition); foreach (var cartItem in items) { RequisitionItem item = new RequisitionItem(); item.SupplierItemID = cartItem.SupplierItem.SupplierItemId; item.NeededQuantity = cartItem.Quantity; item.ReqID = requisition.ReqID; item.IsOutstanding = false; dao.db.RequisitionItems.Add(item); } dao.db.SaveChanges(); #region Send Notifications NotificationController ctl = new NotificationController(); ctl.CreateNotification( user.UserID, string.Format("New approval Requisition request {0}", requisition.ReqNumber), NotificationStatus.Created, Roles.HOD, user.DepartmentID.Value ); string toEmailIds = new UserController().GetToEmailIds(Roles.HOD, user.DepartmentID.Value); //To which role the email should be sent ctl.SendEmail("*****@*****.**", toEmailIds, "New requisition approval request", "New Requisition has been for approval : " + requisition.ReqNumber); #endregion reset(); Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "alertRedirect('Requested Submited for Approval !!!','EmpMain.aspx')", true); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LUUser user = (LUUser)Session["User"]; if (user != null) { lblEmpName.Text = lblUser.Text = user.FirstName + " " + user.LastName; lblUserName.Text = String.Format("{0} - {1}", user.FirstName, user.Role.RoleName); ShowNotifications(); } else { Response.Redirect("~/View/Login.aspx"); } } }
public void GenerateDisbursement(int retrId, LUUser user) { List <Disbursement> dibursements = disbDao.GenerateDisbursebents(retrId); foreach (Disbursement dis in dibursements) { Core.Controller.NotificationController ctl = new NotificationController(); ctl.CreateNotification( user.UserID, string.Format("The Items has been Shipped {0}. Disbursement key =", dis.Key), NotificationStatus.Created, Roles.HOD, dis.DepartmentID.Value ); ctl.CreateNotification( user.UserID, string.Format("The Items has been Shipped {0}. Disbursement key =", dis.Key), NotificationStatus.Created, Roles.REP, dis.DepartmentID.Value ); string toEmailIdsHOD = new UserController().GetToEmailIds(Roles.HOD, dis.DepartmentID.Value); //To which role the email should be sent string toEmailIdsREPS = new UserController().GetToEmailIds(Roles.HOD, dis.DepartmentID.Value); ctl.SendEmail("*****@*****.**", toEmailIdsHOD, "Items for requsition has been shiped", "The disbursement key while receiving item is : " + dis.Key); ctl.SendEmail("*****@*****.**", toEmailIdsREPS, "Items for requsition has been shiped", "The disbursement key while receiving item is : " + dis.Key); } }
private void ShowNotifications() { LUUser user = (LUUser)Session["User"]; }
public void PersistPoItems(Dictionary <PurchaseOrder, List <PurchaseOrderItems> > poitemsList, LUUser user) { foreach (KeyValuePair <PurchaseOrder, List <PurchaseOrderItems> > poi in poitemsList) { foreach (PurchaseOrderItems itm in poi.Value) { PurchaseOrderItem items = new PurchaseOrderItem(); items.PurchaseOrderID = poi.Key.PurchaseOrderID; items.RequestedQuantity = itm.ReorderQuantity; items.ItemID = itm.PoItem.GetSupplierItem().ItemID; items.UnitPrice = POItemDao.GetUnitPrice(itm.PoItem, itm.PoSupplier); POItemDao.db.PurchaseOrderItems.Add(items); POItemDao.db.SaveChanges(); } } }