예제 #1
0
        public ActionResult GetReportTemplates(string MarketId = "", long ClientId = 0, long ProjectId = 0)
        {
            AV_MarketConfigurationBL db = new AV_MarketConfigurationBL();
            var res = db.SelectedList("getReportTemplates", MarketId, ClientId, ProjectId);

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
예제 #2
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"));
            }
        }
예제 #3
0
        public ActionResult RFLegends(FormCollection frm)
        {
            AV_MarketConfigurationBL mcbl = new AV_MarketConfigurationBL();
            var res = mcbl.SaveRFPlotLegend(frm);

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
        public ActionResult DeleteTemplateById(int DataTemplateId)
        {
            AV_MarketConfigurationBL bl = new AV_MarketConfigurationBL();
            string Filter = "DeleteDataTemplateById";
            var    res    = bl.DeleteDataTemplate(Filter, DataTemplateId);

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
 public ActionResult GetTemplateById(int id)
 {
     if (id != 0)
     {
         AV_MarketConfigurationBL bl = new AV_MarketConfigurationBL();
         var res = bl.GetTemplateById("GetTemplateById", id);
         return(Json((res.Rows[0]["Keys"]).ToString().Split(','), JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json("", JsonRequestBehavior.AllowGet));
     }
 }
예제 #6
0
        public ActionResult SaveReportTemplate(long ClientId, long ProjectId, string MarketId, string ReportTemplateName)
        {
            // Check For Existing Report Template
            string Filter = "NewReportTemplate";
            var    user   = Session["user"] as LoginInformation;
            AV_MarketConfigurationBL mc = new AV_MarketConfigurationBL();
            var response = mc.SaveDataTemplate(Filter, MarketId, 0, ClientId, 0, null, null, ProjectId, ReportTemplateName, null, null, 0, user.UserId);

            if (response == "Success")
            {
                return(Json("Saved Successfully"));
            }
            else
            {
                return(Json(response));
            }
        }
예제 #7
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!"));
            }
        }
예제 #8
0
        public bool FileDataParser(long SiteId)
        {
            // Parse File Here
            try
            {
                AV_MarketConfigurationBL bl = new AV_MarketConfigurationBL();

                DataTable WO = bl.GetWorkOrderById("GetWorkOrderById", SiteId);

                long   ClientId     = Convert.ToInt64(WO.Rows[0]["ClientId"]);
                long   ProjectId    = Convert.ToInt64(WO.Rows[0]["ProjectId"]);
                long   MarketId     = Convert.ToInt64(WO.Rows[0]["MarketId"]);;
                long   ScopeId      = Convert.ToInt64(WO.Rows[0]["ScopeId"]);
                string ClientPrefix = WO.Rows[0]["ClientPrefix"].ToString();
                string SiteCode     = WO.Rows[0]["SiteCode"].ToString();

                DataTable dt = bl.GetDataTemplate("GetDataTemplate", ClientId, ProjectId, MarketId, ScopeId);
                if (dt.Rows.Count > 0)
                {
                    for (int p = 0; p < dt.Rows.Count; p++)
                    {
                        string Files        = dt.Rows[p]["Files"].ToString();
                        string Json         = dt.Rows[p]["JsonData"].ToString();
                        string TemplateName = dt.Rows[p]["DataTemplateName"].ToString();

                        List <string> ListofFiles = Files.Split(',').ToList();

                        //var dir = Server.MapPath("~/Content/AirViewLogs/" + ClientPrefix + "\\" + SiteCode);
                        var  dir = Path.Combine(HttpRuntime.AppDomainAppPath, "Content/AirViewLogs/" + ClientPrefix + "/" + SiteCode);
                        bool isDirectoryExists = Directory.Exists(dir);
                        if (isDirectoryExists)
                        {
                            DirectoryInfo d = new DirectoryInfo(dir);                                        //directory/Folder
                            FileInfo[]    directoryFiles = d.GetFiles("*.avx", SearchOption.AllDirectories); //Getting avx files
                            //List<FileInfo> filteredFiles = CheckForAlreadyProcessedFiles(directoryFiles, SiteId);
                            foreach (var file in directoryFiles)
                            {
                                StringBuilder fileName = new StringBuilder();
                                List <string> names    = file.Name.Split('_').ToList();
                                for (int i = 0; i < names.Count; i++)
                                {
                                    if (names[i] != SiteCode)
                                    {
                                        if (i != 0)
                                        {
                                            fileName.Append("_");
                                        }
                                        fileName.Append(names[i]);
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                                foreach (var filename in ListofFiles)
                                {
                                    if (fileName.ToString() == filename)
                                    {
                                        AV_MarketConfigurationBL mc = new AV_MarketConfigurationBL();
                                        string Filter    = "CheckFiles";
                                        var    processed = mc.CheckFiles(Filter, SiteId, file.Name, TemplateName);
                                        if (!processed)
                                        {
                                            // File is Matched with out Saved Pattern So Parse File Here
                                            MainClass        Model = JsonConvert.DeserializeObject <MainClass>(Json);
                                            ParserController PC    = new ParserController();
                                            var       filepath     = file.FullName;
                                            DataTable fileData     = PC.GetParserDataFromFile(Model, filepath);
                                            mc.SaveDataToDataBase(fileData, TemplateName, SiteId);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
예제 #9
0
        public bool CheckExistence(string TemplateName)
        {
            AV_MarketConfigurationBL mc = new AV_MarketConfigurationBL();

            return(mc.checkExistence(TemplateName));
        }