Exemplo n.º 1
0
        public void btnNew_Click()
        {
            ADefHelpDeskTasksQuery      tq = new ADefHelpDeskTasksQuery("tq");
            ADefHelpDeskTasksCollection tc = new ADefHelpDeskTasksCollection();

            tq.SelectAll().Where(tq.RequesterEmail == AppSession.ServiceUnit.UserServiceUnitID, tq.Status == "Resolved", tq.ApprovedByRequestorID.IsNull());
            tc.Load(tq);
            if (tc.Count > 2)
            {
                X.Msg.Alert("Approve needed", "You have finished tasks that required your approval").Show();
                return;
            }

            Window winNew = new Window
            {
                ID          = "winNew",
                Title       = "Add New",
                Height      = 400,
                Width       = 700,
                BodyPadding = 5,
                Modal       = true,
                Closable    = true,
                CloseAction = CloseAction.Hide,
                AutoShow    = false
            };

            winNew.Loader = new ComponentLoader
            {
                Url  = "~/Task/TaskAdd.aspx?isnew=1",
                Mode = LoadMode.Frame
            };
            winNew.Render(this.Form);
            //winNew.Show();
        }
Exemplo n.º 2
0
        public void btnSave_Click()
        {
            if (string.IsNullOrEmpty(txtTitle.Text) && string.IsNullOrEmpty(txtDesc.Text) && string.IsNullOrEmpty(cmbServiceUnit.SelectedItem.Value))
            {
                return;
            }
            ADefHelpDeskTasks           t  = new ADefHelpDeskTasks();
            ADefHelpDeskTasksQuery      tQ = new ADefHelpDeskTasksQuery("a");
            ADefHelpDeskTasksCollection tC = new ADefHelpDeskTasksCollection();
            ADefHelpDeskTaskDetails     tD = new ADefHelpDeskTaskDetails();

            t.PortalID            = 0;
            t.Description         = txtTitle.Text;
            t.Status              = "New";
            t.Priority            = "High";
            t.CreatedDate         = DateTime.Now;
            t.EstimatedStart      = DateTime.Now;
            t.EstimatedCompletion = DateTime.Now.AddDays(7);
            t.DueDate             = DateTime.Now.AddDays(14);
            t.AssignedRoleID      = 1;
            //Password Ticket
            string tikPass = Guid.NewGuid().ToString();

            t.TicketPassword = tikPass;
            t.RequesterEmail = AppSession.ServiceUnit.UserServiceUnitID; //RequesterEmail = the requestor service unit
            t.RequesterPhone = cmbServiceUnit.SelectedItem.Value;        //RequesterPhone = the service unit which take charge of the request
            //Get username ID
            ADefHelpDeskUsersQuery      uq = new ADefHelpDeskUsersQuery("a");
            ADefHelpDeskUsersCollection uc = new ADefHelpDeskUsersCollection();

            uq.SelectAll().Where(uq.Username == HttpContext.Current.User.Identity.Name.ToString().Trim());
            uq.es.Top = 1;
            uc.Load(uq);
            if (uc.Count > 0)
            {
                foreach (ADefHelpDeskUsers u in uc)
                {
                    t.RequesterUserID = u.UserID;
                    t.RequesterName   = u.FirstName;
                }
            }
            t.Save();
            tQ.SelectAll().Where(tQ.TicketPassword == tikPass);
            tQ.es.Top = 1;
            tC.Load(tQ);
            if (tC.Count > 0)
            {
                foreach (ADefHelpDeskTasks tt in tC)
                {
                    tD.TaskID      = tt.TaskID;
                    tD.DetailType  = "Details";
                    tD.InsertDate  = tt.CreatedDate;
                    tD.Description = txtDesc.Text;
                    tD.UserID      = tt.RequesterUserID;
                    tD.Save();
                }
            }
            MessageBus.Default.Publish("grdTask_Refresh");
            //X.Js.Call("onWinClose");
        }
Exemplo n.º 3
0
        public void btnConfirmAlls_Click()
        {
            string messagesuccess = string.Empty;

            if (AppSession.UserLogin.UserID == 36)
            {
                messagesuccess = "Her Majesty Santi Dwiyanti S.Si, Apt, the pride of RSCM Kencana, has successfully confirms all tasks as finished completely ";
            }
            else
            {
                messagesuccess = "PIC successfully confirms all tasks as finished completely";
            }
            ADefHelpDeskTasksQuery      tQ = new ADefHelpDeskTasksQuery("a");
            ADefHelpDeskTasksCollection tC = new ADefHelpDeskTasksCollection();

            tQ.SelectAll().Where(tQ.ApprovedByRequestorID.IsNull(), tQ.ApprovedByRequestorDateTime.IsNull(), tQ.Status == "Resolved");
            if (AppSession.ServiceUnit.UserServiceUnitID != null)
            {
                tQ.Where(tQ.RequesterEmail == AppSession.ServiceUnit.UserServiceUnitID);
            }
            tC.Load(tQ);
            if (tC.Count > 0)
            {
                foreach (var t in tC)
                {
                    ADefHelpDeskTasks at = new ADefHelpDeskTasks();
                    if (at.LoadByPrimaryKey((int)t.TaskID))
                    {
                        at.ApprovedByRequestorID       = AppSession.UserLogin.UserID;
                        at.ApprovedByRequestorDateTime = DateTime.Now;
                        at.Save();
                        X.Msg.Notify("Success", messagesuccess).Show();
                        //Refresh GridPanel
                        MessageBus.Default.Publish("grdTask_Refresh");
                    }
                }
            }
        }