Exemplo n.º 1
0
        private void FillData()
        {
            if (!String.IsNullOrEmpty(queryStringIdStr))
            {
                FAQManager _FAQManager = new FAQManager();
                var        obj         = _FAQManager.GetFAQ(queryStringId);
                if (obj != null)
                {
                    txtQuestion.Text = obj.Question.Replace("<br/>", "\r\n");
                    txtAnswer.Text   = obj.Answer.Replace("<br/>", "\r\n");

                    if (obj.SaudiStudentAssociationId.HasValue)
                    {
                        ddlSSA.Items.FindByValue(obj.SaudiStudentAssociationId.Value.ToString()).Selected = true;
                    }

                    Operation = (String)GetGlobalResourceObject("HCMResource", "UpdateExisting");
                }
                else
                {
                    Operation = (String)GetGlobalResourceObject("HCMResource", "AddNew");
                }
            }
            else
            {
                Operation = (String)GetGlobalResourceObject("HCMResource", "AddNew");
            }
        }
Exemplo n.º 2
0
        public ActionResult ActivityLook(int ID)
        {
            ActivityIntroductionModel activity = new ActivityIntroductionModel();

            activity = new FAQManager().GetActivityIntroductionById(ID);
            return(View(activity));
        }
Exemplo n.º 3
0
 public ActionResult Edit(FAQ faq)
 {
     using (var fm = new FAQManager())
     {
         faq = fm.Edit(faq);
     }
     return(RedirectToAction("List"));
 }
Exemplo n.º 4
0
 public ActionResult Edit(int id)
 {
     using (var fm = new FAQManager())
     {
         var faq = fm.Single(id);
         ViewBag.FAQ = faq;
     }
     return(View("Edit"));
 }
Exemplo n.º 5
0
        public ActionResult List()
        {
            List <FAQ> faqs;

            using (var fm = new FAQManager())
            {
                faqs = fm.All().ToList();
            }

            ViewBag.FAQs = faqs;
            return(View("FAQList"));
        }
Exemplo n.º 6
0
 private void FillData()
 {
     if (queryStringId != 0)
     {
         FAQManager _FAQManager = new FAQManager();
         var        obj         = _FAQManager.GetAllBySSAId(queryStringId).ToList();
         if (obj != null)
         {
             rptData.DataSource = obj;
         }
     }
     rptData.DataBind();
 }
Exemplo n.º 7
0
        public ActionResult ActivityIntroductionList(string activityName, int pageIndex = 1)
        {
            string filter = "";

            if (!string.IsNullOrWhiteSpace(activityName))
            {
                filter = " and ActivityName LIKE N'%" + activityName + @"%'";
            }
            List <ActivityIntroductionModel> list =
                new FAQManager().GetAllActivityIntroductionList(filter, pageIndex, 20);

            return(View(list));
        }
Exemplo n.º 8
0
        public ActionResult AddActivityIntroduction(int ID)
        {
            ActivityIntroductionModel activity = new ActivityIntroductionModel();

            if (ID > 0)
            {
                activity = new FAQManager().GetActivityIntroductionById(ID);
            }
            if (activity == null)
            {
                activity = new ActivityIntroductionModel();
            }
            return(View(activity));
        }
Exemplo n.º 9
0
        /// <summary>
        /// 修改/新增活动信息
        /// </summary>
        /// <param name="activityName"></param>
        /// <param name="orderChannel"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="activityContent"></param>
        /// <param name="ID"></param>
        /// <returns></returns>
        public ActionResult AddOrUpdateActivityIntroduction(string activityName, string orderChannel, string startTime, string endTime, string activityContent, int ID)
        {
            ActivityIntroductionModel activity = new ActivityIntroductionModel();

            activity.ID              = ID;
            activity.ActivityName    = System.Web.HttpUtility.UrlDecode(activityName);
            activity.ActivityChannel = System.Web.HttpUtility.UrlDecode(orderChannel);
            activity.ActivityContent = System.Web.HttpUtility.UrlDecode(activityContent);
            activity.StartTime       = Convert.ToDateTime(startTime);
            activity.EndTime         = Convert.ToDateTime(endTime);
            activity.CreateUser      = User.Identity.Name;
            int returnVal = new FAQManager().AddOrUpActivityIntroduction(activity, "");

            return(Json(returnVal));
        }
Exemplo n.º 10
0
        private void FillData()
        {
            FAQManager _FAQManager = new FAQManager();
            SSAManager _SSAManager = new SSAManager();
            var        user        = AspNetSecurityHelper.currentAppUser;

            if (user != null)
            {
                var obj = _FAQManager.GetAllFAQ();
                if (user.UserTypeId == 2) // Supervisor
                {
                    if (user.UniversityId.HasValue)
                    {
                        var ssa = _SSAManager.GetSSAByUniversityId(user.UniversityId.Value);
                        //var ssa = _SSAManager.GetSSAByAdministratorId(user.Id);
                        if (ssa != null)
                        {
                            obj = _FAQManager.GetAllBySSAId(ssa.Id);
                        }
                        else
                        {
                            obj = null;
                        }
                    }
                }
                if (obj != null)
                {
                    var data = from tbl in obj
                               select new
                    {
                        tbl.Id,
                        tbl.Question,
                        tbl.Answer,
                        SSA   = tbl.SaudiStudentAssociation.University.Name + (tbl.SaudiStudentAssociation.State != null ? " - " + tbl.SaudiStudentAssociation.State.Name : "") + (tbl.SaudiStudentAssociation.City != null ? " - " + tbl.SaudiStudentAssociation.City.Name : "") + (String.IsNullOrEmpty(tbl.SaudiStudentAssociation.Name) ? "" : " - " + tbl.SaudiStudentAssociation.Name),
                        ssaId = tbl.SaudiStudentAssociationId
                    };
                    string ssa   = ddlSSA.SelectedValue;
                    int    ssaId = 0;
                    if (int.TryParse(ssa, out ssaId) && ssaId != 0)
                    {
                        data = data.Where(w => w.ssaId == ssaId).ToList();
                    }
                    GridView1.DataSource = data.ToList();
                }
            }
            GridView1.DataBind();
        }
Exemplo n.º 11
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string     un          = AspNetSecurityHelper.GetCurrentUserName;
            FAQManager _FAQManager = new FAQManager();

            if (e.CommandName == "DeleteUpdate")
            {
                string Id = e.CommandArgument.ToString();
                if (!String.IsNullOrEmpty(Id))
                {
                    int id = 0;
                    if (int.TryParse(Id, out id))
                    {
                        string         operation = (String)GetGlobalResourceObject("HCMResource", "Delete");
                        int            i         = 0;//_FAQManager.DeleteFAQ(id);
                        DAL.Entity.FAQ obj       = _FAQManager.GetFAQ(id);
                        if (obj != null)
                        {
                            obj.DeletedFlag     = true;
                            obj.LastUpdatedBy   = un;
                            obj.LastUpdatedDate = DateTime.Now;
                            i = _FAQManager.UpdateFAQ(obj);
                        }
                        if (i != 0)
                        {
                            ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationSuccess"), operation), "", Common.msgType.alertMessageSuccess);
                        }
                        else
                        {
                            ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationError"), operation), "", Common.msgType.alertMessageDanger);
                        }
                    }
                    FillData();
                }
            }
        }
Exemplo n.º 12
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var user = AspNetSecurityHelper.currentAppUser;

            if (user != null)
            {
                FAQManager _FAQManager = new FAQManager();
                SSAManager _SSAManager = new SSAManager();

                DAL.Entity.FAQ obj = _FAQManager.GetFAQ(queryStringId);
                if (obj == null)
                {
                    obj = new DAL.Entity.FAQ();
                }

                obj.Question = txtQuestion.Text.Replace("\r\n", "<br/>");
                obj.Answer   = txtAnswer.Text.Replace("\r\n", "<br/>");

                if (user.UserTypeId == 2) // Supervisor
                {
                    if (user.UniversityId.HasValue)
                    {
                        var ssa = _SSAManager.GetSSAByUniversityId(user.UniversityId.Value);
                        //var ssa = _SSAManager.GetSSAByAdministratorId(user.Id);
                        if (ssa != null)
                        {
                            obj.SaudiStudentAssociationId = ssa.Id;
                        }
                    }
                }
                else // Administrator
                {
                    string SSA = ddlSSA.SelectedValue;
                    int    ssa = 0;
                    if (int.TryParse(SSA, out ssa) && ssa != 0)
                    {
                        obj.SaudiStudentAssociationId = ssa;
                    }
                }

                int i = 0;
                if (obj.Id == 0)
                {
                    obj.CreatedBy   = user.UserName;
                    obj.CreatedDate = DateTime.Now;
                    obj.DeletedFlag = false;
                    i               = _FAQManager.AddFAQ(obj);
                    Operation       = (String)GetGlobalResourceObject("HCMResource", "Add");
                    btnSave.Visible = false;
                }
                else
                {
                    obj.LastUpdatedBy   = user.UserName;
                    obj.LastUpdatedDate = DateTime.Now;
                    i         = _FAQManager.UpdateFAQ(obj);
                    Operation = (String)GetGlobalResourceObject("HCMResource", "Update");
                }
                if (i != 0)
                {
                    ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationSuccess"), Operation), "", Common.msgType.alertMessageSuccess);
                    FillData();
                }
                else
                {
                    ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationError"), Operation), "", Common.msgType.alertMessageDanger);
                }
            }
            else
            {
                Response.Redirect("/");
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public ActionResult DeleteActivityIntroduction(int ID)
        {
            int returnVal = new FAQManager().DeleteActivityIntroductionById(ID);

            return(Json(returnVal));
        }