Ejemplo n.º 1
0
 public MainFunctions(OutputProcessor output)
 {
     this.output = output;
     // 대소문자 미구분자
     comp = StringComparison.OrdinalIgnoreCase;
     sub  = new SubFunctions(output);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Get Report to display
        /// </summary>
        /// <param name="rptType"></param>
        /// <param name="van"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <returns></returns>
        public JsonResult GetReports(string rptType, string van, DateTime fromDate, DateTime toDate)
        {
            var model = new List <ReportModel>();

            int fromMnth = Convert.ToInt32(fromDate.ToString().Split('/')[0]);
            int toMnth   = Convert.ToInt32(toDate.ToString().Split('/')[0]);

            DataTable dtReport    = AccountDbAccess.GetReport(rptType, van, fromMnth, toMnth);
            DataTable dtQuestions = AccountDbAccess.GetQuestions(rptType);

            if (dtReport != null && dtQuestions != null)
            {
                DataTable dtResult = SubFunctions.DesignReport(dtReport, dtQuestions, rptType);

                if (dtResult != null)
                {
                    foreach (DataRow row in dtResult.Rows)
                    {
                        model.Add(new ReportModel
                        {
                            OrderId    = Convert.ToInt32(row["OrderId"]),
                            QuestionId = row["QuestionId"].ToString(),
                            Question   = row["Question"].ToString(),
                            T3B        = row["T3B"].ToString(),
                            Details    = row["Details"].ToString(),
                            Total      = row["Total"].ToString()
                        });
                    }
                    return(Json(new { data = model }, JsonRequestBehavior.AllowGet));
                }
            }
            return(null);
        }
        public ActionResult AddUser(AddUserModel model)
        {
            string emailError;

            model.groupList = (List <ItemsList>)TempData["groupList"];
            TempData.Keep();

            if (!AccountDbAccess.IsExistingEmail(model.Email, out emailError))
            {
                ModelState.AddModelError("Email", "This email address is already used for another user. Please use a unique email address.");
            }

            if (ModelState.IsValid)
            {
                int createdUserId = 1;
                int msg;

                string temporaryPswd = CommonFunctions.CreatePassword();

                if (temporaryPswd != null)
                {
                    AccountDbAccess.AddNewuser(model.Email, temporaryPswd, model.FirstName, model.LastName, model.Email, model.Phone, Convert.ToInt32(model.selectedGroupId), createdUserId, out msg);

                    if (msg == 0)
                    {
                        //Send mail to created user with username and password
                        if (!SubFunctions.SendNewAccountMail(model.Email, model.FirstName, model.LastName, model.Email, temporaryPswd))
                        {
                            //Show email error msg here
                        }
                        return(JavaScript("window.top.location.href ='" + Url.Action("Index", "UserManagement", new { area = "User" }) + "';"));
                    }
                    else
                    {
                        return(PartialView(model));
                    }
                }
                else
                {
                    return(PartialView(model));
                }
            }
            else
            {
                return(PartialView(model));
            }
        }
Ejemplo n.º 4
0
        public ActionResult ResetPassword(ResetPasswordModel model)
        {
            if (ModelState.IsValid)
            {
                //int outputMessage;
                SubFunctions.SendResetEmail(model.email);

                ViewBag.message     = "Successfully reset password";
                ViewBag.messageType = "success";
            }
            else
            {
                ModelState.AddModelError("Login", "Login failed");

                ViewBag.message     = "Login failed";
                ViewBag.messageType = "error";
            }

            return(PartialView(model));
        }