public void bntCreate_Click(Object sender, EventArgs e) { var id = Page.Request.Params["id"]; var user = new Users() { ID = Convert.ToInt32(tbUID.Text) }; user.GetById(); if (String.IsNullOrEmpty(user.Name)) { lblError.Text = "Пользователя с таким UID не существует!"; return; } var issuancelists = new IssuanceLists() { Comment = tbComment.Text, IssuanceDate = Convert.ToDateTime(tbIssuanceDate.Text), UserID = Convert.ToInt32(tbUID.Text), IssuanceListsStatusID = 1 }; if (id == null) { issuancelists.Create(); } else { issuancelists.ID = Convert.ToInt32(id); issuancelists.Update(); } Page.Response.Redirect("~/ManagerUI/Menu/Issuance/IssuanceListsView.aspx"); }
public static bool CloseIssuanceList(Int32 issuanceListId) { var isAllTicketsChanged = true; var user = (Users)HttpContext.Current.Session["userinsession"]; var rolesList = HttpContext.Current.Application["RolesList"] as List <Roles>; var currentRole = (Roles)rolesList.SingleOrDefault(u => u.Name.ToLower() == user.Role.ToLower()); var currentTickets = new Tickets { IssuanceListID = issuanceListId }; var ds = currentTickets.GetAllItems("ID", "ASC", "IssuanceListID"); foreach (DataRow row in ds.Tables[0].Rows) { var currentTicket = new Tickets { ID = Convert.ToInt32(row["ID"]) }; currentTicket.GetById(); var updateTicket = new Tickets { ID = Convert.ToInt32(row["ID"]) }; var statusError = TicketsFilter.StatusChangeFilter(ref updateTicket, currentTicket.DriverID.ToString(), currentTicket.StatusID.ToString(), currentTicket.StatusDescription, currentTicket.AdmissionDate.ToString(), null, "6", null, currentRole); if (statusError != null && isAllTicketsChanged == true) { isAllTicketsChanged = false; } updateTicket.Update(user.ID, OtherMethods.GetIPAddress(), "IssuanceListsView"); } var issuanceList = new IssuanceLists { ID = issuanceListId }; issuanceList.GetById(); issuanceList.IssuanceListsStatusID = 2; issuanceList.Update(); return(isAllTicketsChanged); }