Пример #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
        protected void Page_Load(object sender, EventArgs e)
        {
            string username = HttpContext.Current.User.Identity.Name;
            ADefHelpDeskUsersQuery      uu  = new ADefHelpDeskUsersQuery();
            ADefHelpDeskUsersCollection uuC = new ADefHelpDeskUsersCollection();

            uu.SelectAll().Where(uu.Username == username);
            uu.es.Top = 1;
            uuC.Load(uu);
            //foreach (ADefHelpDeskUsers uuu in uuC)
            //{
            //    Session["UserID"] = uuu.UserID;
            //    Session["ServiceUnitID"] = string.Empty;
            //    ADefHelpDeskUserUserGroupQuery ug = new ADefHelpDeskUserUserGroupQuery("a");
            //    ADefHelpDeskUserUserGroupCollection ugC = new ADefHelpDeskUserUserGroupCollection();
            //    ug.SelectAll().Where(ug.UserID == username);
            //    ug.es.Top = 1;
            //    ugC.Load(ug);
            //    if (ugC.Count > 0)
            //    {
            //        foreach (ADefHelpDeskUserUserGroup uug in ugC)
            //        {
            //            Session["ServiceUnitID"] = uug.UserServiceUnitID;
            //        }
            //    }
            //}

            if (!X.IsAjaxRequest)
            {
                this.storeStatus.DataSource = new object[]
                {
                    new object[] { "New", "New" },
                    new object[] { "Resolved", "Resolved" },
                    new object[] { "Cancelled", "Cancelled" },
                    new object[] { "On Hold", "On Hold" }
                };
                this.storeStatus.DataBind();
                this.cmbStatus.SetRawValue("New");
                StoreReadDataEventArgs ee = new StoreReadDataEventArgs();
                storeTask_ReadData(sender, ee);
                storeNeedApproval_ReadData(sender, ee);
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["ServiceUnitID"] == null)
                {
                    return;
                }
            }
            AppUserCollection userColl = new AppUserCollection();

            userColl.es.Connection.Name = "KENCANA";
            AppUserQuery userQ = new AppUserQuery("a");

            userQ.es2.Connection.Name = "KENCANA";
            userQ.SelectAll();
            userColl.Load(userQ);
            if (userColl.Count >= 1)
            {
                foreach (AppUser au in userColl)
                {
                    ADefHelpDeskUsersQuery hlpUserQ = new ADefHelpDeskUsersQuery("uQ");
                    hlpUserQ.es2.Connection.Name = "HELPDESK";
                    hlpUserQ.SelectAll().Where(hlpUserQ.Username == au.UserID);
                    DataTable dtU = hlpUserQ.LoadDataTable();
                    if (dtU.Rows.Count == 0)
                    {
                        ADefHelpDeskUsers hlpUser = new ADefHelpDeskUsers();
                        hlpUser.es.Connection.Name = "HELPDESK";
                        hlpUser.Username           = au.UserID;
                        hlpUser.FirstName          = au.UserName;
                        hlpUser.LastName           = ".";
                        hlpUser.IsSuperUser        = false;
                        hlpUser.Email    = au.UserID + "@rscmkencana.com";
                        hlpUser.Password = au.Password;
                        hlpUser.Save();
                    }
                }
            }
        }
Пример #4
0
        protected bool UserLogin(string userName, string password)
        {
            _user.es.Connection.Name = "KENCANA";
            //_user.es.Connection.Name = "LOCAL_HIS";
            if (_user.LoadByPrimaryKey(userName))
            {
                if (_user.Password.Equals(Crypto.Encrypt(password)))
                {
                    ADefHelpDeskUsersQuery q = new ADefHelpDeskUsersQuery();
                    q.SelectAll().Where(q.Username == userName);
                    ADefHelpDeskUsersCollection c = new ADefHelpDeskUsersCollection();
                    c.Load(q);
                    ADefHelpDeskUsers a = new ADefHelpDeskUsers();
                    if (c.Count == 0)
                    {
                        a.Username    = userName;
                        a.Password    = _user.Password;
                        a.FirstName   = _user.UserName;
                        a.LastName    = ".";
                        a.IsSuperUser = false;
                        a.Email       = userName + "@rscmkencana.com";
                        a.Save();

                        ADefHelpDeskUsersQuery      aa = new ADefHelpDeskUsersQuery();
                        ADefHelpDeskUsersCollection ac = new ADefHelpDeskUsersCollection();
                        aa.SelectAll().Where(aa.Username == userName);
                        ac.Load(aa);

                        foreach (ADefHelpDeskUsers U in ac)
                        {
                            ADefHelpDeskUsers _u = new ADefHelpDeskUsers();
                            _u.UserID            = (int)U.UserID;
                            _u.Username          = userName;
                            _u.FirstName         = _user.UserName;
                            AppSession.UserLogin = _u;
                        }
                    }
                    if (c.Count == 1)
                    {
                        foreach (ADefHelpDeskUsers U in c)
                        {
                            if (a.LoadByPrimaryKey((int)U.UserID))
                            {
                                ADefHelpDeskUsers _u = new ADefHelpDeskUsers();
                                _u.UserID            = (int)U.UserID;
                                _u.Username          = userName;
                                _u.FirstName         = _user.UserName;
                                AppSession.UserLogin = _u;

                                a.Username    = userName;
                                a.Password    = _user.Password;
                                a.FirstName   = _user.UserName;
                                a.LastName    = ".";
                                a.IsSuperUser = false;
                                a.Email       = userName + "@rscmkencana.com";
                                a.Save();
                            }
                        }
                    }
                    //Get user service unit
                    ADefHelpDeskUserUserGroupQuery      ugQ = new ADefHelpDeskUserUserGroupQuery("a");
                    ADefHelpDeskUserUserGroupCollection ugC = new ADefHelpDeskUserUserGroupCollection();
                    ugQ.SelectAll().Where(ugQ.UserID == userName).es.Top = 1;
                    ugC.Load(ugQ);
                    if (ugC.Count == 1)
                    {
                        foreach (ADefHelpDeskUserUserGroup ug in ugC)
                        {
                            Session["ServiceUnitID"] = ug.UserServiceUnitID;
                            AppSession.ServiceUnit   = ug;
                        }
                    }
                    else
                    {
                        X.Msg.Notify("Error", "This user has not been registered to any service unit").Show();
                        return(false);
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }