Beispiel #1
0
        public ActionResult ViewMashov(string file_number, string form_ver)
        {
            // get the user
            UserData user = (UserData)this.Session["user"];

            if (user.Type.ToLower() == "momhee")
            {
                // check if the momhee has excess to this request
                if (!RequestManager.Manager.IsRequestAllowedForMomhee(user.Id, file_number))
                {
                    return(RedirectToAction("RequestsManage", "AdminGovExp"));
                }
            }
            // load the mashov
            var    dataFile = Server.MapPath("~/App_Data/Mashovs/mashov_" + file_number + ".json");
            string json     = System.IO.File.ReadAllText(@dataFile);
            Dictionary <string, string> values = FormValues.LoadJson(json).Values;
            // load the form of the mashov
            var        mashovFile = Server.MapPath("~/App_Data/Forms/MashovForm_v_" + form_ver + ".xml");
            PostedForm pR         = new PostedForm(FormManager.Manager.Load(mashovFile).FormComponents[0], values);

            // load extra data of the request
            string where        = "file_number='" + file_number + "'";
            ViewData["request"] = RequestManager.Manager.GetAllWhere(where, null, 1, 1)[0];
            ViewData["names"]   = RequestManager.Manager.GetAllColNames();

            return(View(pR));
        }
        public ActionResult AddMashov(string file_number, string isContinue, string form_ver)
        {
            // check if the momhee has this request
            UserData user = (UserData)this.Session["user"];

            if (!RequestManager.Manager.IsRequestAllowedForMomhee(user.Id, file_number))
            {
                return(RedirectToAction("RequestManage", "AdminGovExp"));
            }
            // add extra data of the request for the mashov page
            string where        = "file_number='" + file_number + "'";
            ViewData["request"] = RequestManager.Manager.GetAllWhere(where, null, 1, 1)[0];
            ViewData["names"]   = RequestManager.Manager.GetAllColNames();

            var temp = new Dictionary <string, string>();

            // check if continue
            if (isContinue != null && isContinue.ToLower() == "true")
            {
                // load the save file
                var    dataFile = Server.MapPath("~/App_Data/Mashovs/temp_" + file_number + ".json");
                string json     = System.IO.File.ReadAllText(@dataFile);
                temp = FormValues.LoadJson(json).Values;
            }
            else
            {
                Settings sett = Settings.GetSettings();
                temp["file_version"] = sett.MashovVersion.ToString();
            }
            // load the mashov form
            var mashovFile = Server.MapPath("~/App_Data/Forms/MashovForm_v_" + temp["file_version"] + ".xml");

            // add extra data for "pull from" fields
            temp["file_number"]  = file_number;
            temp["gov_exp_name"] = user.Name;
            temp["misrad_name"]  = user.Office;
            ViewData["temp"]     = temp;
            FormComponent mashovForm = FormManager.Manager.Load(mashovFile);

            if (isContinue != null && isContinue.ToLower() == "true")
            {
                // validate the filled in fields
                ValidateAllNotEmpty(temp, mashovForm);
            }
            return(View(mashovForm.FormComponents[0]));
        }