/// <summary> /// /// </summary> public Boolean StartValidation() { Boolean retVal = false; try { Console.WriteLine("Validation StartValidation Routine ===>"); retVal = StartValidator(); #region ApplicationLogEntries ApplicationEventMaster Event = unitOfWork.ApplicationEventMasterRepository .SelectByID(Constants.EventType.Validation_Engine_Started); ApplicationMaster application = unitOfWork.ApplicationMasterRepository .SelectByID(Constants.ApplicationId); ApplicationLog obj = unitOfWork.CreateApplicationLogObject(Event, application, "LoremIpsumMessage", "amjad.leghari"); unitOfWork.ApplicationLogRepository.Insert(obj); unitOfWork.Save(); #endregion Console.WriteLine("<=== Validation StartValidation routine ended."); } catch (Exception ex) { throw ex; } return(retVal); }
public async Task <ActionResult <ApplicationMaster> > PostApplicationMaster(ApplicationMaster applicationMaster) { _context.ApplicationMaster.Add(applicationMaster); await _context.SaveChangesAsync(); return(CreatedAtAction("GetApplicationMaster", new { id = applicationMaster.ApplicationId }, applicationMaster)); }
public void Stop() { try { #region ApplicationLogEntries ApplicationEventMaster Event = unitOfWork.ApplicationEventMasterRepository .SelectByID(Constants.EventType.Validation_Engine_Stopped); ApplicationMaster Application = unitOfWork.ApplicationMasterRepository .SelectByID(Constants.ApplicationId); ApplicationLog obj = unitOfWork.CreateApplicationLogObject(Event, Application, "LoremIpsumMessage", "amjad.leghari"); unitOfWork.ApplicationLogRepository.Insert(obj); unitOfWork.Save(); #endregion this.unitOfWork.Dispose(); this.Rules = null; this.ConfigXmlDocument = null; this.config = null; } catch (Exception ex) { throw ex; } }
public IActionResult Put(int id, [FromBody] keyvalueModel value) { ApplicationMaster _applicationMaster = new ApplicationMaster() { ApplicationId = value.Id, ApplicationName = value.keyValue, IsDeleted = false }; TicketDB.Entry(_applicationMaster).State = EntityState.Modified; return(Ok(TicketDB.SaveChanges())); }
public void Create(ApplicationMaster obj) { try { db.ApplicationMasters.Add(obj); } catch (Exception) { throw; } }
public void Update(ApplicationMaster obj) { try { ApplicationMaster aemObject = this.db.ApplicationMasters.FirstOrDefault(aem => aem.Id == obj.Id && aem.IsActive); aemObject = obj; } catch (Exception) { throw; } }
public IActionResult Post([FromBody] keyvalueModel value) { var app = new ApplicationMaster() { ApplicationId = value.Id, ApplicationName = value.keyValue, IsDeleted = false }; TicketDB.ApplicationMaster.Add(app); TicketDB.SaveChanges(); TicketDB.Dispose(); return(CreatedAtAction(nameof(GetById), new { id = app.ApplicationId })); }
public void Delete(int Id) { try { ApplicationMaster aemObject = this.db.ApplicationMasters.FirstOrDefault(aem => aem.Id == Id && aem.IsActive); aemObject.IsActive = false; } catch (Exception) { throw; } }
public virtual void TestTimelineClientInDSAppMaster() { ApplicationMaster appMaster = new ApplicationMaster(); appMaster.appSubmitterUgi = UserGroupInformation.CreateUserForTesting("foo", new string[] { "bar" }); Configuration conf = new YarnConfiguration(); conf.SetBoolean(YarnConfiguration.TimelineServiceEnabled, true); appMaster.StartTimelineClient(conf); NUnit.Framework.Assert.AreEqual(appMaster.appSubmitterUgi, ((TimelineClientImpl)appMaster .timelineClient).GetUgi()); }
/// <summary> /// /// </summary> /// <param name="Name"></param> /// <param name="configFilePath"></param> /// <param name="createdBy"></param> /// <param name="LastUpdatedBy"></param> /// <returns></returns> public ApplicationMaster CreateApplicationMaster(string Name, string configFilePath, string createdBy, string LastUpdatedBy) { ApplicationMaster obj = new ApplicationMaster(); obj.Name = Name; obj.ConfigFilePath = configFilePath; obj.CreatedBy = createdBy; obj.CreatedDate = DateTime.Now; obj.LastUpdatedBy = LastUpdatedBy; obj.LastUpdatedDate = DateTime.Now; obj.IsActive = true; return(obj); }
public ApplicationMaster SelectById(int Id) { ApplicationMaster retVal = null; try { retVal = this.db.ApplicationMasters.FirstOrDefault(aem => aem.Id == Id && aem.IsActive); } catch (Exception) { throw; } return(retVal); }
public string GenrateHtmlTPDF(string html, ApplicationMaster data) { try { //if (System.IO.File.Exists(HttpContext.Server.MapPath("~/applicant/data.pdf"))){ // System.IO.File.Delete(HttpContext.Server.MapPath("~/applicant/data.pdf")); //} //System.IO.File.Create(HttpContext.Server.MapPath("~/applicant/data.pdf")); Download(HttpContext.Server.MapPath("~/applicant/data.pdf")); return("true"); } catch (Exception ex) { return("false"); } }
/// <summary> /// Get All Applications details /// </summary> /// <param name="ID"></param> /// <returns></returns> public int GetAllApplications(int ID) { sqlconn = new SqlConnection(sqlconnectionstring); sqlconn.Open(); string SP = GlobalConstant.USP_GetAllApplications; sqlcmd = new SqlCommand(SP, sqlconn); sqlcmd.CommandType = CommandType.StoredProcedure; sqlcmd.Parameters.AddWithValue("@ID", ID); SqlDataReader returnLst = sqlcmd.ExecuteReader(); ApplicationMaster objAM = new ApplicationMaster(); while (returnLst.Read()) { objAM.AppID = Convert.ToInt16(returnLst["AppID"]); } sqlconn.Close(); return(objAM.AppID); }
/// <summary> /// /// </summary> public void Configure() { configureValidator(); #region ApplicationLogEntries ApplicationEventMaster Event = unitOfWork.ApplicationEventMasterRepository .SelectByID(Constants.EventType.Validation_Engine_Configured); ApplicationMaster Application = unitOfWork.ApplicationMasterRepository .SelectByID(Constants.ApplicationId); ApplicationLog objApplicationLog = unitOfWork .CreateApplicationLogObject(Event, Application, "LoremIpsumMessage", "amjad.leghari"); unitOfWork.ApplicationLogRepository.Insert(objApplicationLog); unitOfWork.Save(); #endregion }
public ValidatorEngine(XDocument xDoc) { try { ApplicationMaster objApplicationMaster = unitOfWork.ApplicationMasterRepository .SelectByID(Constants.ApplicationId); Helper.XMLHelper <ConfigurationStore> .Instance .UnMarshalingFromXML(objApplicationMaster.ConfigFilePath, out configurationStore); /*--------------------*/ this.ConfigXmlDocument = XDocument.Load(objApplicationMaster.ConfigFilePath); this.config = configurationStore.Items[0]; this.CurrentXmlDocument = xDoc;//XDocument.Load(this.config.source_file_path); } catch (Exception ex) { throw ex; } }
/// <summary> /// Get All applications names /// </summary> /// <returns></returns> public IEnumerable <ApplicationMaster> GetAllApplications() { sqlconn = new SqlConnection(sqlconnectionstring); sqlconn.Open(); string SP = GlobalConstant.USP_GetAllApplications; sqlcmd = new SqlCommand(SP, sqlconn); sqlcmd.CommandType = CommandType.StoredProcedure; SqlDataReader returnLst = sqlcmd.ExecuteReader(); List <ApplicationMaster> Lstmenu = new List <ApplicationMaster>(); while (returnLst.Read()) { ApplicationMaster m = new ApplicationMaster(); m.AppID = (int)returnLst["AppID"]; m.AppName = returnLst["AppName"].ToString(); Lstmenu.Add(m); } return(Lstmenu); }
/// <summary> /// /// </summary> /// <param name="xDoc"></param> public ValidatorEngine(XDocument xDoc) { try { ApplicationMaster objApplicationMaster = unitOfWork.ApplicationMasterRepository .SelectByID(Constants.ApplicationId); //TODO validate the rule xml using the xsd Helper.XMLManagement <ValidationRuleEngine.Configuration.ConfigurationStore> .Instance .UnMarshalingFromXML(objApplicationMaster.ConfigFilePath, out configurationStore); /*--------------------*/ this.ConfigXmlDocument = XDocument.Load(objApplicationMaster.ConfigFilePath); this.config = configurationStore.Items[0]; this.CurrentXmlDocument = xDoc;//XDocument.Load(this.config.source_file_path); } catch (Exception ex) { Logger.Instance.GetLogInstance().Error(JsonConvert.SerializeObject(ex)); } }
public FailContainerLaunchNMCallbackHandler(ContainerLaunchFailAppMaster _enclosing , ApplicationMaster applicationMaster) : base(applicationMaster) { this._enclosing = _enclosing; }
/// <summary> /// /// </summary> /// <param name="Event"></param> /// <param name="Application"></param> /// <param name="message"></param> /// <param name="userId"></param> /// <returns></returns> public ApplicationLog CreateApplicationLogObject(ApplicationEventMaster Event, ApplicationMaster Application, string message, string userId) { ApplicationLog obj = new ApplicationLog(); obj.Id = Guid.NewGuid(); obj.ApplicationEventMaster = Event; obj.ApplicationMaster = Application; obj.Message = message; obj.TimeStamp = DateTime.Now; obj.UserId = userId; return(obj); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ValidationEventHandler(object sender, ValidationEventArgs e) { try { var dataType = ""; if (e.Severity == XmlSeverityType.Warning) { Console.Write("WARNING: "); Console.WriteLine(e.Message); } else if (e.Severity == XmlSeverityType.Error) { if (!errorDetected) { this.errorDetected = true; #region ApplicationLogEntries DB Entry ApplicationEventMaster Event = unitOfWork.ApplicationEventMasterRepository .SelectByID(Constants.EventType.Standard_Xml_Validation_Failed); ApplicationMaster Application = unitOfWork.ApplicationMasterRepository .SelectByID(Constants.ApplicationId); ApplicationLog objAppLog = unitOfWork.CreateApplicationLogObject(Event, Application, "LoremIpsumMessage", "amjad.leghari"); unitOfWork.ApplicationLogRepository.Insert(objAppLog); unitOfWork.Save(); #endregion } IXmlLineInfo node = sender as IXmlLineInfo; if (node != null && node.HasLineInfo()) { Console.WriteLine(node.LinePosition); Console.WriteLine(node.LineNumber); } Console.Write("ERROR: "); Console.WriteLine(e.Message); Console.Write("DataKey: "); var obj = sender as XmlReader; Console.WriteLine(obj.Name); Console.Write("DataValue: "); Console.WriteLine(obj.Value); if (obj.SchemaInfo.SchemaElement != null) { Console.Write("DataType: "); dataType = obj.SchemaInfo.SchemaElement.ElementSchemaType.Datatype.TypeCode.ToString(); Console.WriteLine(dataType); } if (String.IsNullOrEmpty(dataType)) { if (e.Message.Contains("cannot appear more than once")) { dataType = "duplicate elements"; } } var xPath = elementStack.Reverse().Aggregate(string.Empty, (x, y) => x + "/" + y); if (!xPath.Contains(obj.Name)) { xPath += String.Format("/{0}", obj.Name); } Console.Write("XPath: "); Console.WriteLine(xPath); #region ErrorXml DB Entry if (currentErrorXml == null) { currentErrorXml = unitOfWork.CreateErrorXml( clientCode, warehouseCode, String.IsNullOrEmpty(orderNumber) ? "dummy order number" : orderNumber, this.varDocumentType, orderDate, DateTime.Now, this.inProcessXML); unitOfWork.ErrorXmlRepository.Insert(currentErrorXml); unitOfWork.Save(); } #endregion //Attribute temp = this.LocalAttributes.Where(attr => attr.name.Equals(obj.Name)).First<Attribute>(); bool IsRectifiable = /*(temp!=null) ? temp.is_rectifiable : */ false; if (obj.SchemaInfo != null) { if (obj.SchemaInfo.SchemaElement != null) { if (obj.SchemaInfo.SchemaElement.UnhandledAttributes != null) { //if (obj.SchemaInfo.SchemaElement.moreAttributes.Count > 0) if (obj.SchemaInfo.SchemaElement.UnhandledAttributes.Count() > 0) { if (obj.SchemaInfo.SchemaElement.UnhandledAttributes .Where(attr => attr.Name.Equals("")).Count() > 0) { IsRectifiable = Convert.ToBoolean(obj.SchemaInfo .SchemaElement.UnhandledAttributes .Where(attr => attr.Name.Equals("")).First <XmlAttribute>().Value); } } } } } #region ErrorInboundData DB Entry ErrorInboundData objErrInbound = unitOfWork.CreateErrorInboundData(obj.Name, xPath, dataType, obj.Value, this.validator_type, e.Message, "not available", unitOfWork.ErrorXmlRepository.SelectByID(currentErrorXml.Id), IsRectifiable); unitOfWork.ErrorInboundRepository.Insert(objErrInbound); unitOfWork.Save(); #endregion #region ErrorSuggestion DB Entry Error_Suggestion_InboundData_Mapper esidmapObj = new Error_Suggestion_InboundData_Mapper(); esidmapObj.Id = Guid.NewGuid(); switch (objErrInbound.DataType.ToLower()) { case "integer": esidmapObj.ErrorSuggestionId = Constants.Suggestions.XSD_Invalid_Integer; break; case "float": esidmapObj.ErrorSuggestionId = Constants.Suggestions.XSD_Invalid_Float; break; case "datetime": esidmapObj.ErrorSuggestionId = Constants.Suggestions.XSD_Invalid_DateTime; break; case "boolean": esidmapObj.ErrorSuggestionId = Constants.Suggestions.XSD_Invalid_Boolean; break; case "duplicate elements": esidmapObj.ErrorSuggestionId = Constants.Suggestions.XSD_Duplicate_Element; break; case "string": esidmapObj.ErrorSuggestionId = Constants.Suggestions.XSD_Invalid_String; break; default: break; } esidmapObj.ErrorInboundDataId = objErrInbound.Id; esidmapObj.DateTime = DateTime.Now; unitOfWork.ErrorSuggestion_InboundDataRepository.Insert(esidmapObj); unitOfWork.Save(); #endregion } } catch (Exception ex) { Logger.Instance.GetLogInstance().Error(JsonConvert.SerializeObject(ex)); } }
public ActionResult StudentStep3(StudentStep3 data, string subjects) { try { if (ModelState.IsValid) { StudAppDBEntities db = new StudAppDBEntities(); TempData["Step3"] = data; TempData.Keep(); var step1 = (StudentStep1)TempData["Step1"]; var step2 = (StudentStep2)TempData["Step2"]; var step3 = data; ApplicationMaster app = new ApplicationMaster(); app.ApplicantName = step1.ApplicantName; app.ApplicationNumber = DateTime.Now.ToString("MMddmmssff"); app.EntryDate = DateTime.Now; app.BoardId = step1.BoardId; app.PassingYearId = step1.PassingYearId; app.ExamType = step1.ExamType == "Annual"?1:2; app.BOD = Convert.ToDateTime(step1.BOD); app.RollCode = step1.RollCode; app.RollNumber = step1.RollNumber; app.FatherName = step1.FatherName; app.MotherName = step1.MotherName; app.S10MaxiMarks = string.IsNullOrEmpty(step1.S10MaxiMarks)?0: Convert.ToInt32(step1.S10MaxiMarks); app.S10TotalMarks = string.IsNullOrEmpty(step1.S10TotalMarks) ? 0 : Convert.ToInt32(step1.S10TotalMarks); app.Is10Compartmentally = step1.Is10Compartmentally == null?false: (bool)step1.Is10Compartmentally; app.SchoolName = step1.SchoolName; app.SchoolAddress = step1.SchoolAddress; app.DistrictId = step1.DistrictId; app.YearOfJoin = step1.YearOfJoin; app.YearOfLeaving = step1.YearOfLeaving; app.Gender = step2.GenderId.ToString(); app.MotherTongue = step2.MotherToungueId.ToString(); app.Nationality = step2.Nationalityid.ToString(); app.Religion = step2.ReligionId.ToString(); app.BloodGroup = step2.BloodGroupId.ToString(); app.State = step2.StateId.ToString(); app.District = step2.AddressDistrictId.ToString(); app.Block = step2.BlockId.ToString(); app.HouseAddress = step2.HouseNo.ToString(); app.PinCode = step2.PinCode.ToString(); app.MobileNo = step2.MobileNo.ToString(); app.Email = step2.Email.ToString(); if (!string.IsNullOrEmpty(step2.STD) && !string.IsNullOrEmpty(step2.PhoneNo)) { app.TelephoneNo = step2.STD.ToString() + "-" + step2.PhoneNo; } app.ReservationId = Convert.ToInt16(step2.Cast); app.EWS = Convert.ToInt16(step2.EWS); if (!string.IsNullOrEmpty(step2.IsSpeciallyAbled)) { app.SpecialAbied = (step2.IsSpeciallyAbled == "No") ? 0 : 1; } app.IsActive = true; app.StudentSubjects = subjects; db.ApplicationMasters.Add(app); int id = db.SaveChanges(); if (id > 0) { AppCollegeMaster dt = new AppCollegeMaster(); dt.ApllicationId = id; dt.CollegeId = step3.step3CollegeId; dt.DistrictId = step3.step3DistrictId; dt.StremId = step3.StreamId; db.AppCollegeMasters.Add(dt); db.SaveChanges(); var data_Application = GetStudentbyId(id); string htmlString = null; using (FileStream fs = System.IO.File.Open(HttpContext.Server.MapPath("~/form/form.html"), FileMode.Open, FileAccess.ReadWrite)) { using (StreamReader sr = new StreamReader(fs)) { htmlString = sr.ReadToEnd(); } } //GenrateHtmlTPDF(htmlString, data_Application); //byte[] bytes = Encoding.Default.GetBytes(htmlString); var html = htmlString; html = html.Replace("@@college1", "3"); html = html.Replace("@@college2", "1"); html = html.Replace("@@college3", "0"); html = html.Replace("@@college4", "1"); html = html.Replace("@@college5", "1"); var RegNo = app.ApplicationNumber.ToString().Select(x => new string(x, 1)).ToArray(); for (var i = 0; i < RegNo.Count(); i++) { html = html.Replace("@@Reg" + (i + 1), RegNo[i]); } html = html.Replace("@@RegisterationNo", app.RollNumber.ToString()); html = html.Replace("@@CollegeName", "L.S COLLEGE,MUZZAFARPUR"); html = html.Replace("@@StudentName", step1.ApplicantName); html = html.Replace("@@FatherName", step1.FatherName); html = html.Replace("@@MotherName", step1.MotherName); html = html.Replace("value=" + step2.GenderId, "value=" + step2.GenderId + " checked='checked'"); html = html.Replace("value=Cast" + step2.Cast, "value=Cast" + step2.Cast + " checked='checked'"); var res = step2.MobileNo.Select(x => new string(x, 1)).ToArray(); for (var i = 0; i < res.Count(); i++) { html = html.Replace("@@Mobile" + i, res[i]); } html = html.Replace("@@Email", step2.Email); var Rcode = step1.RollCode.Select(x => new string(x, 1)).ToArray(); for (var i = 0; i < Rcode.Count(); i++) { html = html.Replace("@@RollCode" + i, Rcode[i]); } var RNumber = step1.RollNumber.Select(x => new string(x, 1)).ToArray(); for (var i = 0; i < RNumber.Count(); i++) { html = html.Replace("@@RollNumber" + i, RNumber[i]); } var year = db.YearMasters.Where(a => a.Year == step1.PassingYearId).FirstOrDefault().Year.ToString(); var sYear = year.Select(x => new string(x, 1)).ToArray(); for (var i = 0; i < sYear.Count(); i++) { html = html.Replace("@@PYear" + i, sYear[i]); } byte[] bytes = Encoding.Default.GetBytes(html);// TempData["html"] = html; TempData.Keep(); // System.IO.File.Create(HttpContext.Server.MapPath("~/applicant/data.pdf")); System.IO.File.WriteAllBytes(HttpContext.Server.MapPath("~/applicant/data1.pdf"), bytes); } return(Json(new { result = true, path = "data1.pdf" }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { ex.SetLog(ex.Message); } return(Json(false, JsonRequestBehavior.AllowGet)); }
/// <summary> /// /// </summary> /// <returns></returns> public override bool Validate() { try { XmlReaderSettings settings = new XmlReaderSettings(); settings.Schemas.Add( this.LocalAttributes .Where(item => item.name == Constants.XsdValidator_CustomFields.xsd_ns) .First <ValidationRuleEngine.Configuration.Attribute>().value, this.LocalAttributes .Where(item => item.name == Constants.XsdValidator_CustomFields.xsd_file_path) .First <ValidationRuleEngine.Configuration.Attribute>().value); settings.ValidationType = ValidationType.Schema; settings.ValidationEventHandler += new ValidationEventHandler(ValidationEventHandler); XmlReader reader = XmlReader.Create(this.currentXml.CreateReader(), settings); #region ApplicationLogEntries DB Entry ApplicationEventMaster Event = unitOfWork.ApplicationEventMasterRepository .SelectByID(Constants.EventType.Standard_Xml_Validation_Started); ApplicationMaster Application = unitOfWork.ApplicationMasterRepository .SelectByID(Constants.ApplicationId); ApplicationLog objApplicationLog = unitOfWork.CreateApplicationLogObject(Event, Application, "LoremIpsumMessage", "amjad.leghari"); unitOfWork.ApplicationLogRepository.Insert(objApplicationLog); unitOfWork.Save(); #endregion while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { elementStack.Push(reader.Name); } if (reader.NodeType == XmlNodeType.EndElement || (reader.NodeType == XmlNodeType.Element && reader.IsEmptyElement)) { elementStack.Pop(); } } if (!errorDetected) { #region ApplicationLogEntries DB Entry Event = unitOfWork.ApplicationEventMasterRepository.SelectByID(Constants.EventType.Standard_Xml_Validation_Succeeded); Application = unitOfWork.ApplicationMasterRepository.SelectByID(Constants.ApplicationId); objApplicationLog = unitOfWork.CreateApplicationLogObject(Event, Application, "LoremIpsumMessage", "amjad.leghari"); unitOfWork.ApplicationLogRepository.Insert(objApplicationLog); unitOfWork.Save(); #endregion } currentErrorXml = null; } catch (Exception ex) { errorDetected = true; Logger.Instance.GetLogInstance().Error(JsonConvert.SerializeObject(ex)); } return(!errorDetected); }