Esempio n. 1
0
        public ActionResult UpdateTemplate(MainClass Model, List <string> Keys,
                                           int Value = 0, string TemplateName = "")
        {
            ParserController PC     = new ParserController();
            var    filepath         = "";
            string keystring        = string.Join(",", Keys.ToArray());
            JavaScriptSerializer js = new JavaScriptSerializer();
            string jsonData         = js.Serialize(Model);

            DataTable dt                = PC.getData(Model, filepath);
            var       dtColumns         = dt.Columns;
            AV_MarketConfigurationBL mc = new AV_MarketConfigurationBL();
            string Filter               = "UpdateTemplate";
            var    response             = mc.SaveDataTemplate(Filter, null, 0, 0, 0, null, null, 0, null, jsonData, keystring, Value, 0);
            bool   IsUpdate             = true;
            bool   IsCreated            = mc.CreateDataTemplateTable(IsUpdate, TemplateName, dtColumns);

            if (IsCreated)
            {
                // Insert Data To Table
                // mc.SaveDataToDataBase(dt, TemplateName);

                return(Json("Template Updated Successfully"));
            }
            else
            {
                return(Json("SomeThing Went Wrong"));
            }
        }
Esempio n. 2
0
        public ActionResult SaveTemplate(long ReportTypeId, long ScopeId,
                                         string TemplateName, string Files,
                                         int ReportTemplateId, MainClass Model, List <string> Keys)
        {
            TemplateName = TemplateName.Replace(' ', '_');
            bool exists = CheckExistence(TemplateName);

            if (!exists)
            {
                ParserController PC     = new ParserController();
                var    filepath         = "";
                string keystring        = string.Join(",", Keys.ToArray());
                JavaScriptSerializer js = new JavaScriptSerializer();
                string jsonData         = js.Serialize(Model);
                var    user             = Session["user"] as LoginInformation;

                DataTable dt                = PC.getData(Model, filepath);
                var       dtColumns         = dt.Columns;
                AV_MarketConfigurationBL mc = new AV_MarketConfigurationBL();
                string Filter               = "NewTemplate";
                var    response             = mc.SaveDataTemplate(Filter, null, ReportTypeId, 0, ScopeId, TemplateName, Files, 0, null, jsonData, keystring, ReportTemplateId, user.UserId);
                bool   IsUpdate             = false;
                bool   IsCreated            = mc.CreateDataTemplateTable(IsUpdate, TemplateName, dtColumns);
                if (IsCreated)
                {
                    // Insert Data To Table
                    //mc.SaveDataToDataBase(dt, TemplateName);

                    return(Json("Template Created Successfully"));
                }
                else
                {
                    return(Json("SomeThing Went Wrong"));
                }
            }
            else
            {
                return(Json("Template name already exists!"));
            }
        }