コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            cgApp   = new CateGoryApplication();
            tickApp = new TicketsApplication();
            tsApp   = new TimeSheetApplication();
            projApp = new ProjectApplication();

            try
            {
                if (!string.IsNullOrEmpty(Request.Params["date"]))
                {
                    this.SelectedDate = Convert.ToDateTime(Request.QueryString["date"]);
                    if (!TimeSheetTicket.CanEdit(this.SelectedDate))
                    {
                        Alert("This date is invalid", "ListTimesheet.aspx");
                    }
                }
                else
                {
                    this.SelectedDate = DateTime.Now;
                }
            }
            catch
            {
                this.SelectedDate = DateTime.Now;
            }
            if (!IsPostBack)
            {
                InitControls();
                this.Title = string.Format("Write Timesheet - {0}", this.SelectedDate.ToString("MM/dd/yyyy"));
            }
        }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     cgApp   = new CateGoryApplication();
     tickApp = new TicketsApplication();
     trApp   = new TicketsRelationApplication();
     if (!IsPostBack)
     {
         InitControl();
     }
 }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ((Normal)this.Master).CurrentModule = Codes.SelectedSunnetMenu.Ticket;
     if (!IsPostBack)
     {
         //CateGory
         CateGoryApplication   cgApp  = new CateGoryApplication();
         List <CateGoryEntity> listCC = cgApp.GetCateGroyListByUserID(((BasePage)this.Page).UserInfo.ID);
         rptCategory.DataSource = listCC;
         rptCategory.DataBind();
     }
 }
コード例 #4
0
ファイル: Main.Master.cs プロジェクト: KhaledSMQ/SunNet.PM
        protected void Page_Load(object sender, EventArgs e)
        {
            TopMenu1.ParentID = 1;

            UserApplication userApp = new UserApplication();

            string keyPath = "/sunnet/";
            string url     = Request.Url.AbsolutePath.ToLower();

            string topModule = url.Replace(keyPath, "");

            topModule = topModule.Substring(0, topModule.IndexOf("/") + 1);
            topModule = keyPath + topModule;

            ModulesEntity moduleTop = userApp.GetModule(topModule);

            if (moduleTop != null)
            {
                if (UserInfo.Role == RolesEnum.CLIENT && moduleTop.ModuleTitle.Trim().ToLower() == "clients")
                {
                    moduleTop.ModuleTitle = "Tickets";
                }
                this.TopSelectedIndex = moduleTop.ID;
                ltlCurrentModule.Text = moduleTop.ModuleTitle;
            }

            //url += Request.Url.Query;
            ModulesEntity moduleCurrent = userApp.GetModule(url);

            if (moduleCurrent != null)
            {
                this.LeftSelectedIndex       = moduleCurrent.ParentID;
                this.LeftSecondSelectedIndex = moduleCurrent.ID;
            }

            //CateGory
            CateGoryApplication   cgApp  = new CateGoryApplication();
            List <CateGoryEntity> listCC = cgApp.GetCateGroyListByUserID(UserInfo.ID);

            rptCategory.DataSource = listCC;
            rptCategory.DataBind();
            rptCateGory2.DataSource = listCC;
            rptCateGory2.DataBind();

            // Client Or Sunnet
            topMenu_category.Visible = UserInfo.Role != RolesEnum.CLIENT;
            InitCompanyInfo();
        }
コード例 #5
0
        private void InitControls()
        {
            CateGoryApplication   cgApp = new CateGoryApplication();
            List <CateGoryEntity> list  = cgApp.GetCateGroyListByUserID(UserInfo.ID);

            list.BindDropdown(ddlCategorys, "Title", "ID", "Please Select", "0");
            if (list != null && list.Count == 1)
            {
                ddlCategorys.AddEmptyItem(0, "Please Select", "0", true);
            }
            List <ProjectDetailDTO> listProj = projApp.GetUserProjects(UserInfo);

            if (listProj != null && listProj.Count > 0)
            {
                listProj.BindDropdown <ProjectDetailDTO>(ddlProject, "Title", "ID", "Please Select", "0");
            }

            if (listProj != null && listProj.Count == 1)
            {
                ddlProject.AddEmptyItem(0, "Please Select", "0", true);
            }
        }
コード例 #6
0
ファイル: CateGory.ashx.cs プロジェクト: KhaledSMQ/SunNet.PM
        public void ProcessRequest(HttpContext context)
        {
            CateGoryApplication ccApp   = new CateGoryApplication();
            HttpRequest         request = context.Request;

            context.Response.ContentType = "text/plain";
            if (IdentityContext.UserID <= 0)
            {
                context.Response.Write("[]");
                return;
            }
            if (string.IsNullOrEmpty(request["type"]))
            {
                List <CateGoryEntity> listcategories = ccApp.GetCateGroyListByUserID(UserID);
                if (listcategories == null || listcategories.Count == 0)
                {
                    context.Response.Write("[]");
                }
                else
                {
                    string jsonCategories = UtilFactory.Helpers.JSONHelper.GetJson <List <CateGoryEntity> >(listcategories);
                    context.Response.Write(jsonCategories);
                }
            }
            else
            {
                int  ticketid   = 0;
                int  categoryid = 0;
                bool checkinput = (
                    (!string.IsNullOrEmpty(request["ticketid"])) &&
                    (!string.IsNullOrEmpty(request["cagetoryid"])) &&
                    int.TryParse(request["ticketid"], out ticketid) &&
                    int.TryParse(request["cagetoryid"], out categoryid) &&
                    ticketid >= 0 &&
                    categoryid > 0);
                if (checkinput)
                {
                    CateGoryTicketEntity model = CateGoryFactory.CreateCateGoryTicketEntity(UserID, ObjectFactory.GetInstance <ISystemDateTime>());
                    model.TicketID   = ticketid;
                    model.CategoryID = categoryid;
                    switch (request["type"])
                    {
                    case "addtocategory":
                        int id = ccApp.AssignTicketToCateGory(model);
                        if (id > 0)
                        {
                            context.Response.Write("true");
                        }
                        else
                        {
                            context.Response.Write("false");
                        }
                        break;

                    case "removefromcategory":
                        bool result = ccApp.RemoveTicketFromCateGory(ticketid, categoryid);
                        context.Response.Write(result.ToString().ToLower());
                        break;

                    case "deletecategory":
                        bool result2 = ccApp.DeleteCateGroy(categoryid);
                        context.Response.Write(result2.ToString().ToLower());
                        break;

                    default:
                        context.Response.Write("null");
                        break;
                    }
                }
                else
                {
                    context.Response.Write("false");
                }
            }
        }
コード例 #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ccApp = new CateGoryApplication();
 }