Пример #1
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");
        }
Пример #2
0
        public void btnComment_Click()
        {
            if (string.IsNullOrEmpty(txtComment.Text.Trim()))
            {
                X.Msg.Notify("Empty comment disallowed", "Comment must not empty").Show();
                return;
            }
            if (Session["TaskID"] == null)
            {
                X.Msg.Notify("Select at least one task", "You must select a task above first").Show();
                return;
            }
            if (AppSession.UserLogin == null)
            {
                X.Msg.Notify("Session timeout", "Your Session has expired, Please do some re-login first").Show();
                Session.Abandon();
                Session.RemoveAll();
                FormsAuthentication.SignOut();
                return;
            }
            ADefHelpDeskUsers u = (ADefHelpDeskUsers)AppSession.UserLogin;
            int UserID          = (int)u.UserID;
            int TaskID          = (int)Session["TaskID"];
            //int UserID = (int)Session["UserID"];
            ADefHelpDeskTaskDetails td = new ADefHelpDeskTaskDetails();

            td.TaskID     = TaskID;
            td.DetailType = "Comment-Visible";
            td.InsertDate = DateTime.Now;
            //td.UserID = (int)Session["UserID"];
            td.UserID      = (int)u.UserID;
            td.Description = txtComment.Text.Trim();
            td.Save();
            X.Msg.Notify("Excelent. You, as the RSCM Kencana best employee", "Just made the greatest and the wisest comment in the human history").Show();
            txtComment.Text = string.Empty;
            grdTask_Select();
        }
Пример #3
0
        public void btnSave_Click()
        {
            int taskID = 0;

            if (Session["taskid"] != null)
            {
                taskID = (int)Session["taskid"];
            }
            else
            {
                Response.Redirect("~/404.aspx");
            }

            ADefHelpDeskTasks                 t   = new ADefHelpDeskTasks();
            ADefHelpDeskTaskDetails           td  = new ADefHelpDeskTaskDetails();
            ADefHelpDeskTaskDetailsQuery      tdQ = new ADefHelpDeskTaskDetailsQuery("a");
            ADefHelpDeskTaskDetailsCollection tdC = new ADefHelpDeskTaskDetailsCollection();

            if (t.LoadByPrimaryKey(taskID))
            {
                t.Description = txtTitle.Text;
                tdQ.SelectAll().Where(tdQ.TaskID == taskID, tdQ.DetailType == "Details");
                tdQ.es.Top = 1;
                tdC.Load(tdQ);
                if (tdC.Count > 0)
                {
                    foreach (ADefHelpDeskTaskDetails ttt in tdC)
                    {
                        if (td.LoadByPrimaryKey((int)ttt.DetailID))
                        {
                            td.Description = txtDesc.Text;
                            td.Save();
                        }
                    }
                }
                t.Save();
            }



            //t.PortalID = 0;
            //t.Description = txtDesc.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
            //Guid g = new Guid();
            //t.TicketPassword = Guid.NewGuid().ToString();
            //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();
            MessageBus.Default.Publish("grdTask_Refresh");
            //X.Js.Call("onWinClose");
        }