public List <string> GenerateRawSQLStatement(RawSQL statement) { if (statement.Engines.Count > 0 && statement.Engines.Contains("MySQL") == false) { return new List <string>() { } } ; if (statement.Statement.Contains(";")) { // Multiple statements. if (!statement.Statement.Contains(StatementSeparator)) { throw new Exception("RawSQL statement with multiple statements must contain statement separator." + Environment.NewLine + statement.Statement); } } return(new List <string>() { statement.Statement }); } }
internal SavedAttendanceModal GetSavedAttendance(string actCode, DateTime actDate) { var tableResponse = _dbConnection.GetModelDetails(RawSQL.GetSavedAttendance(actCode, actDate)); SavedAttendanceModal peopleList = new SavedAttendanceModal(); List <SavedAttendancePeopleModal> attendPeopleList = new List <SavedAttendancePeopleModal>(); foreach (DataRow dataRow in tableResponse.AsEnumerable()) { var record = new SavedAttendancePeopleModal() { BranchName = "OD Branch", Gender = dataRow.Field <string>("Gender"), Name = dataRow.Field <string>("Name_Full"), IniJigStatus = dataRow.Field <string>("INI_JIG_NON") == "INI" ? "Initiated" : dataRow.Field <string>("INI_JIG_NON") == "CHL" ? "Child" : dataRow.Field <string>("INI_JIG_NON") == "OTH" ? "Other" : dataRow.Field <string>("INI_JIG_NON") == "JIG" ? "Jigyasu" : "", IsSantSu = dataRow.Field <string>("Sant_su") != null ? "Y": "N", UidNo = dataRow.Field <string>("UID_No") ?? "", RollNo = dataRow.Field <Int16>("Roll_No").ToString() }; attendPeopleList.Add(record); } peopleList.SavedAttendancePeopleModals = attendPeopleList; peopleList.SavedAttendancePeopleModals.AddRange(GetSavedVisitorsAttendance(actCode, actDate)); var actRes = _dbConnection.GetModelDetails(RawSQL.GetSingleActivity(actCode, actDate)); peopleList.ActivityDate = actDate; peopleList.ActivityName = actRes.AsEnumerable().FirstOrDefault()?.Field <string>("ActName"); return(peopleList); }
internal BranchPeoplePaginationAttendance GetPeoplesIndividualAttendance(BranchPeopleAttendance branchPeopleAttendance) { var tableResponse = _dbConnection.GetModelDetails(RawSQL.ReportsBranchIndividualAttendance(branchPeopleAttendance)); List <BranchPeopleAttendance> lst = new List <BranchPeopleAttendance>(); foreach (DataRow dataRow in tableResponse.AsEnumerable()) { var record = new BranchPeopleAttendance() { UidNo = dataRow.Field <string>("UID_No") ?? "", Name = dataRow.Field <string>("Name_Full"), RollNo = Convert.ToInt32(dataRow.Field <double>("Roll_No")), BrTitle = dataRow.Field <string>("INI_JIG_NON") == "INI" ? "Initiated" : dataRow.Field <string>("INI_JIG_NON") == "CHL" ? "Children" : dataRow.Field <string>("INI_JIG_NON") == "OTH" ? "Other" : dataRow.Field <string>("INI_JIG_NON") == "JIG" ? "Jigyasu" : "", AttendanceCount = dataRow.Field <int?>("AttendanceCount"), ActivityName = dataRow.Field <string>("Act_Name"), AttendanceDate = dataRow.Field <DateTime?>("Act_Date") }; lst.Add(record); } var finalLst = new BranchPeoplePaginationAttendance { BranchPeopleAttendance = lst, Count = 0 }; return(finalLst); }
internal bool SubmitActivityAttendance(SubmitActivityAttendanceModal submitActivityAttendanceModal) { var tableResponse = _dbConnection.GetModelDetails(RawSQL.GetVoidedAttendance(submitActivityAttendanceModal.ActivityDate, submitActivityAttendanceModal.ActivityCode)); var checkRec = tableResponse.AsEnumerable().FirstOrDefault(); if (checkRec != null) { throw new CustomException("Selected Activity is voided, unable to post attendance"); } return(_dbConnection.SaveActivityAttendance(submitActivityAttendanceModal)); }
static void Main(string[] args) { // bring all Words var allWordsDB = DAL.SDK.Kit.Instance.Words.GetAllMainWords(); // bring words with unexisting sinonims var allWordsWithNoSinonims = new List <WordMain>(); foreach (var item in allWordsDB) { var allSinonims = DAL.SDK.Kit.Instance.WordSinonims.GetSinonimsByWordId(item.lexemId); if (allSinonims.Count < 10) { allWordsWithNoSinonims.Add(item); } } foreach (var word in allWordsWithNoSinonims) { var sinonims = GetSinonimsFromDictooByWord(word.FormNoAcc); //intins , larg var log = word.FormNoAcc; foreach (var sinonim in sinonims) { if (sinonim != string.Empty && sinonim != " ") { // get words that exists in DB for asociation //var id2 = allWordsDB.Where(w => w.FormNoAcc == sinonim).ToList(); var id2 = DAL.SDK.Kit.Instance.Words.GetAllWordsByName(sinonim.ToString().Trim().Replace('ş', 'ș')); RawSQL.executeQuery("exec WordsMainGetByName N'" + sinonim.ToString().Trim().Replace('ş', 'ș') + "'"); var id3 = DAL.SDK.Kit.Instance.Words.GetAllWordsByName("rămas"); var id4 = DAL.SDK.Kit.Instance.Words.GetAllWordsByName("diferă"); // method 1 if (id2.Count() != 0) { var id = id2.First().lexemId; DAL.SDK.Kit.Instance.WordSinonims.AddSinonim(word.lexemId, id, DateTime.Now); } else { DAL.SDK.Kit.Instance.WordSinonims.AddSinonimMissingWord(word.lexemId, DateTime.Now, sinonim); } } } } }
private IStatement ParseRawSQLStatement(XmlNode statement) { RawSQL rawSQLStatement = new RawSQL(); rawSQLStatement.Statement = statement.InnerText; foreach (XmlAttribute attribute in statement.Attributes) { if (string.Compare(attribute.Name, "Engine", true) == 0) { rawSQLStatement.Engines.Add(attribute.Value); } } return(rawSQLStatement); }
public List <string> GenerateRawSQLStatement(RawSQL statement) { if (statement.Engines.Count > 0 && statement.Engines.Contains("PGSQL") == false) { return new List <string>() { } } ; return(new List <string>() { statement.Statement }); } }
private List <SavedAttendancePeopleModal> GetSavedVisitorsAttendance(string actCode, DateTime actDate) { var tableResponse = _dbConnection.GetModelDetails(RawSQL.GetSaveVisitorsAttendance(actCode, actDate)); List <SavedAttendancePeopleModal> attendPeopleList = new List <SavedAttendancePeopleModal>(); foreach (DataRow dataRow in tableResponse.AsEnumerable()) { var record = new SavedAttendancePeopleModal() { BranchName = "Visitors Branch", Gender = dataRow.Field <string>("Gender"), Name = dataRow.Field <string>("VisitorName"), IniJigStatus = dataRow.Field <string>("Initiated").ToLower() == "yes" ? "Initiated" : "Other" }; attendPeopleList.Add(record); } return(attendPeopleList); }
internal Task <List <ActivityAttendanceModal> > GetPeopleDate(string status) { var tableResponse = _dbConnection.GetModelDetails(RawSQL.GetAllPeopleList(status)); List <ActivityAttendanceModal> peopleList = new List <ActivityAttendanceModal>(); Parallel.ForEach(tableResponse.AsEnumerable(), dataRow => { lock (lockPeople) { var record = new ActivityAttendanceModal() { UidNo = dataRow.Field <string>("UID_No") ?? "", Name = dataRow.Field <string>("Name_Full"), RollNo = Convert.ToInt32(dataRow.Field <double>("Roll_No")), IniJigStatus = dataRow.Field <string>("INI_JIG_NON") == "INI" ? "Initiated" : dataRow.Field <string>("INI_JIG_NON") == "CHL" ? "Children" : dataRow.Field <string>("INI_JIG_NON") == "OTH" ? "Other" : dataRow.Field <string>("INI_JIG_NON") == "JIG" ? "Jigyasu" : "", FamilyCode = Convert.ToInt32(dataRow.Field <double>("Family_cd")) }; peopleList.Add(record); } }); //foreach (DataRow dataRow in tableResponse.AsEnumerable()) //{ // var record = new ActivityAttendanceModal() // { // UidNo = dataRow.Field<string>("UID_No") ?? "", // Name = dataRow.Field<string>("Name_Full"), // RollNo = Convert.ToInt32(dataRow.Field<double>("Roll_No")), // IniJigStatus = dataRow.Field<string>("INI_JIG_NON") == "INI" ? "Initiated" // : dataRow.Field<string>("INI_JIG_NON") == "CHL" ? "Children" // : dataRow.Field<string>("INI_JIG_NON") == "OTH" ? "Other" // : dataRow.Field<string>("INI_JIG_NON") == "JIG" ? "Jigyasu" : "", // FamilyCode = Convert.ToInt32(dataRow.Field<double>("Family_cd")) // }; // peopleList.Add(record); //} return(Task.FromResult(peopleList)); }
internal GetUserLoginObject CheckUserPassWord(Credentials credentials) { _logger.LogInformation($"$$$$$$ --- USER----{credentials.UserName} ----------$$$$$$$$$"); var checkPassword = _dbConnection.GetModelDetails(RawSQL.GetAllUserPassword(credentials.UserName)); var checkSecurity = checkPassword.AsEnumerable().FirstOrDefault(); if (checkSecurity != null) { if (checkSecurity.Field <string>("UserName").Trim() == credentials.UserName && checkSecurity.Field <string>("Password").Trim() == credentials.Password) { var tableResponse = _dbConnection.GetModelDetails(RawSQL.CheckAuth(credentials.UserName, credentials.Password)); var tableRow = tableResponse.AsEnumerable().FirstOrDefault(); if (tableRow != null) { var record = new GetUserLoginObject() { UserName = tableRow.Field <string>("Name_Full"), RollNo = Convert.ToInt32(tableRow.Field <double>("Roll_No")), UidNo = tableRow.Field <string>("UID_No") ?? "", RolesDetailsList = GetUserRoles(credentials.UserName) }; return(record); } else { throw new CustomException("Invalid Login details entered.", HttpStatusCode.OK); } } else { throw new CustomException("Invalid Login details entered.", HttpStatusCode.OK); } } else { throw new CustomException("Invalid Login details entered.", HttpStatusCode.OK); } }
internal List <UserFamilyModal> GetFamilyData(string uidNo) { var familyCode = _dbConnection.GetModelDetails(RawSQL.GetFamilyCode(uidNo)).AsEnumerable().FirstOrDefault(); var familyMemeber = _dbConnection.GetModelDetails(RawSQL.GetAllFamilyPeople(familyCode?.Field <double?>("Family_cd"))).AsEnumerable().ToList(); var userFamily = new List <UserFamilyModal>(); foreach (var detail in familyMemeber) { var personBrInfo = new UserFamilyModal { Name = detail?.Field <string>("Name_Full"), IniJigStatus = detail?.Field <string>("INI_JIG_NON") == "INI" ? "Initiated" : detail?.Field <string>("INI_JIG_NON") == "CHL" ? "Children" : detail?.Field <string>("INI_JIG_NON") == "OTH" ? "Other" : detail?.Field <string>("INI_JIG_NON") == "JIG" ? "Jigyasu" : "", Relation = detail?.Field <string>("Reelation"), UidNo = detail?.Field <string>("Uid_No"), RollNo = Convert.ToInt32(detail?.Field <double?>("Roll_No")) }; userFamily.Add(personBrInfo); } return(userFamily); }
internal List <UserRolesModal> GetUserRoles(string userName) { var tableResponse = JsonConvert.SerializeObject(_dbConnection.GetModelDetails(RawSQL.GetUserIndividualRoles(userName))); return(JsonConvert.DeserializeObject <List <UserRolesModal> >(tableResponse)); }
public VoucherController(IUnitOfWork work, IConfiguration configuration, IMapper mapper) : base(work) { _work = work; _sql = new RawSQL(configuration); _mapper = mapper; }
internal UserProfileModal GetProfileData(string uidNo, string rollNo) { UserProfileModal userProfileModal = new UserProfileModal(); var genInfo = _dbConnection.GetModelDetails(RawSQL.GetProfileData(uidNo, rollNo)).AsEnumerable().FirstOrDefault(); var branchInfo = _dbConnection.GetModelDetails(RawSQL.GetProfileBrInfo(Convert.ToDouble(rollNo))).AsEnumerable().FirstOrDefault(); var sdfsd = genInfo.Table; var profileData = new ProfileInfo() { Title = genInfo?.Field <string>("Title"), FullName = genInfo?.Field <string>("Name_Full"), DateOfBirth = genInfo?.Field <DateTime?>("Date_Birth"), Gender = genInfo?.Field <string>("Gender"), Caste = genInfo?.Field <string>("Caste"), MaritalStatus = Convert.ToString(genInfo?.Field <Double?>("Marital_Status")) == "0" ? "Married" : Convert.ToString(genInfo?.Field <Double?>("Marital_Status")) == "1" ? "Single" : Convert.ToString(genInfo?.Field <Double?>("Marital_Status")) == "3" ? "Widowed" : Convert.ToString(genInfo?.Field <Double?>("Marital_Status")) == "4" ? "Divorced" : Convert.ToString(genInfo?.Field <Double?>("Marital_Status")) == "5" ? "Other" : "Other", Nationality = genInfo?.Field <string>("Nationality") == "I" ? "Indian" : "Other", AadharNo = genInfo.Field <string>("AadharNo"), PanNo = genInfo.Field <string>("PanCardNo") }; var contactData = new ContactInfo() { ResidenceAddr = genInfo?.Field <string>("Add1") + genInfo?.Field <string>("Add2") + genInfo?.Field <string>("Add3"), City = genInfo?.Field <string>("City"), Pincode = genInfo?.Field <string>("Pin_cd"), MobileNo1 = genInfo?.Field <string>("Mobile"), MobileNo2 = genInfo?.Field <string>("Mobile1"), EmergencyContact = genInfo?.Field <string>("EmergencyContact"), EmergencyContactNo = genInfo?.Field <string>("EmergencyContactNo"), Email1 = genInfo?.Field <string>("Email1"), Email2 = genInfo?.Field <string>("Email2") }; var occupationData = new CompanyInfo { OrgName = genInfo?.Field <string>("Organization"), OrgAddress = genInfo?.Field <string>("Place"), Designation = genInfo?.Field <string>("Designation"), Occupation = genInfo?.Field <string>("Occupation"), OfficePh1 = genInfo?.Field <string>("Off_ph1"), OfficePh2 = genInfo?.Field <string>("Off_ph2") }; var qualificationData = new QualificationInfo { Qualification = genInfo?.Field <string>("Qualification") }; var personBrInfo = new PersonBrInfo { RollNo = Convert.ToInt32(genInfo?.Field <Double?>("Roll_NO")), UidNo = genInfo?.Field <string>("UID_No"), BrTitle = genInfo?.Field <string>("Title_1"), GridCoord = genInfo?.Field <string>("Grid_Coord"), DateOfIni1 = branchInfo?.Field <DateTime?>("DOI_1"), DateOfIni2 = branchInfo?.Field <DateTime?>("DOI_2") }; userProfileModal.ProfileList = profileData; userProfileModal.ContactInfo = contactData; userProfileModal.CompanyInfo = occupationData; userProfileModal.QualificationInfo = qualificationData; userProfileModal.PersonBrInfo = personBrInfo; return(userProfileModal); }
internal List <BranchAttendanceSummary> GetPeopleAttendanceSummary(BranchPeopleSummaryModel branchPeopleAttendance) { List <BranchPeopleAttendance> lst = new List <BranchPeopleAttendance>(); // Registered Users Attendance Result var branchAttendance = _dbConnection.GetModelDetails(RawSQL.ReportsBranchPeopleSummary(branchPeopleAttendance)); foreach (DataRow dataRow in branchAttendance.AsEnumerable()) { var record = new BranchPeopleAttendance() { BrTitle = dataRow.Field <string>("INI_JIG_NON") == "INI" ? "Initiated" : dataRow.Field <string>("INI_JIG_NON") == "CHL" && string.IsNullOrWhiteSpace(dataRow.Field <string>("SANT_SU")) ? "Children" : dataRow.Field <string>("INI_JIG_NON") == "CHL" && !string.IsNullOrWhiteSpace(dataRow.Field <string>("SANT_SU")) ? "SantSu" : dataRow.Field <string>("INI_JIG_NON") == "OTH" ? "Other" : dataRow.Field <string>("INI_JIG_NON") == "JIG" ? "Jigyasu" : "", ActivityName = dataRow.Field <string>("Act_Name"), AttendanceDate = dataRow.Field <DateTime?>("Act_Date") }; lst.Add(record); } // Visitors Attendance Result var visitorsAttendance = _dbConnection.GetModelDetails(RawSQL.ReportsBranchVisitorsPeopleSummary(branchPeopleAttendance.ActivityCode, branchPeopleAttendance.StartDate, branchPeopleAttendance.EndDate)); foreach (DataRow dataRow in visitorsAttendance.AsEnumerable()) { var record = new BranchPeopleAttendance() { BrTitle = dataRow.Field <string>("Initiated").ToLower() == "yes".ToLower() ? "Initiated" : "Other", ActivityName = dataRow.Field <string>("Act_Name"), AttendanceDate = dataRow.Field <DateTime?>("Act_Date"), IsVisitors = true }; lst.Add(record); } List <BranchAttendanceSummary> finalLst = new List <BranchAttendanceSummary>(); foreach (var calc in lst.OrderBy(s => s.AttendanceDate).GroupBy(s => new { s.ActivityName, s.AttendanceDate })) { var totalIni = calc.Where(s => s.IsVisitors != true).Count(s => s.BrTitle == "Initiated"); var totalJig = calc.Count(s => s.BrTitle == "Jigyasu"); var totalOther = calc.Where(s => s.IsVisitors != true).Count(s => s.BrTitle == "Other"); var totalChild = calc.Count(s => s.BrTitle == "Children"); var totalSantSu = calc.Count(s => s.BrTitle == "SantSu"); var totalVisitorIni = calc.Where(s => s.IsVisitors).Count(s => s.BrTitle == "Initiated"); var totalVisitorOthers = calc.Where(s => s.IsVisitors).Count(s => s.BrTitle == "Other"); var totalPeople = totalIni + totalJig + totalOther + totalChild + totalSantSu + totalVisitorIni + totalVisitorOthers; finalLst.Add(new BranchAttendanceSummary { ActivityName = calc.Key.ActivityName, AttendanceDate = calc.Key.AttendanceDate, TotalIni = totalIni, TotalJig = totalJig, TotalChil = totalChild + totalSantSu, TotalOther = totalOther, TotalVisitorIni = totalVisitorIni, TotalVisitorOther = totalVisitorOthers, TotalPeople = totalPeople }); } // Voided Attendance List <BranchPeopleAttendance> voidLst = new List <BranchPeopleAttendance>(); var branchVoidedRec = _dbConnection.GetModelDetails(RawSQL.ReportsBranchPeopleAttendanceVoided(branchPeopleAttendance.ActivityCode, branchPeopleAttendance.StartDate, branchPeopleAttendance.EndDate)); foreach (DataRow dataRow in branchVoidedRec.AsEnumerable()) { var record = new BranchPeopleAttendance() { BrTitle = "NA", ActivityName = dataRow.Field <string>("Act_Name"), AttendanceDate = dataRow.Field <DateTime?>("Act_Date") }; voidLst.Add(record); } foreach (var add in voidLst) { finalLst.Add(new BranchAttendanceSummary { ActivityName = add.ActivityName, AttendanceDate = add.AttendanceDate, TotalIni = -1, TotalJig = -1, TotalChil = -1, TotalOther = -1, TotalVisitorIni = -1, TotalVisitorOther = -1, TotalPeople = -1, }); } return(finalLst); }
internal BranchPeoplePaginationAttendance GetPeopleAttendance(BranchPeopleAttendance branchPeopleAttendance, int page) { var lst = new List <BranchPeopleAttendance>(); // Users Attendance var tableResponse = _dbConnection.GetModelDetails(RawSQL.ReportsBranchPeopleAttendance(branchPeopleAttendance)); foreach (DataRow dataRow in tableResponse.AsEnumerable()) { var record = new BranchPeopleAttendance { UidNo = dataRow.Field <string>("UID_No") ?? "", Name = dataRow.Field <string>("Name_Full"), RollNo = Convert.ToInt32(dataRow.Field <double>("Roll_No")), BrTitle = dataRow.Field <string>("INI_JIG_NON") == "INI" ? "Initiated" : dataRow.Field <string>("INI_JIG_NON") == "CHL" ? "Children" : dataRow.Field <string>("INI_JIG_NON") == "OTH" ? "Other" : dataRow.Field <string>("INI_JIG_NON") == "JIG" ? "Jigyasu" : "", AttendanceCount = dataRow.Field <int?>("AttendanceCount"), ActivityName = dataRow.Field <string>("Act_Name"), SingleActivityCode = dataRow.Field <string>("Act_cd"), AttendanceDate = dataRow.Field <DateTime?>("Act_Date"), MobileNum = dataRow.Field <string>("Mobile") }; lst.Add(record); } // Visitors Attendance Result var visitorsAttendance = _dbConnection.GetModelDetails(RawSQL.ReportsBranchVisitorsPeopleSummary(branchPeopleAttendance.ActivityCode, branchPeopleAttendance.StartDate, branchPeopleAttendance.EndDate)); foreach (DataRow dataRow in visitorsAttendance.AsEnumerable()) { var record = new BranchPeopleAttendance() { BrTitle = dataRow.Field <string>("Initiated").ToLower() == "yes".ToLower() ? "Initiated" : "Other", ActivityName = dataRow.Field <string>("Act_Name"), AttendanceDate = dataRow.Field <DateTime?>("Act_Date"), IsVisitors = true }; lst.Add(record); } // Voided Records var tableResponseVoidedRec = _dbConnection.GetModelDetails(RawSQL.ReportsBranchPeopleAttendanceVoided(branchPeopleAttendance.ActivityCode, branchPeopleAttendance.StartDate, branchPeopleAttendance.EndDate)); foreach (DataRow dataRow in tableResponseVoidedRec.AsEnumerable()) { var record = new BranchPeopleAttendance { UidNo = "NA", Name = "NA", RollNo = -1, BrTitle = "NA", AttendanceCount = -1, ActivityName = dataRow.Field <string>("Act_Name"), SingleActivityCode = dataRow.Field <string>("Act_cd"), AttendanceDate = dataRow.Field <DateTime?>("Act_Date"), MobileNum = "NA" }; lst.Add(record); } var count = lst.Count(); var finalLst = new BranchPeoplePaginationAttendance { BranchPeopleAttendance = lst.Skip((page - 1) * 500).Take(500).ToList(), Count = count }; return(finalLst); }
internal List <UserRolesModal> GetUserRolesData() { var tableResponse = JsonConvert.SerializeObject(_dbConnection.GetModelDetails(RawSQL.GetUserRolesData())); return(JsonConvert.DeserializeObject <List <UserRolesModal> >(tableResponse)); }
internal List <SecurityObjects> GetUserRoles(string userName) { var tableRes = JsonConvert.SerializeObject(_dbConnection.GetModelDetails(RawSQL.GetAllUserRoles(userName))); return(JsonConvert.DeserializeObject <List <SecurityObjects> >(tableRes)); }
internal List <LocalityPeople> GetLocalityPeople(int localityId) { var tableResponse = JsonConvert.SerializeObject(_dbConnection.GetModelDetails(RawSQL.GetLocalityPeople(localityId))); return(JsonConvert.DeserializeObject <List <LocalityPeople> >(tableResponse)); }
internal Task <List <AllActivityCode> > GetAllActivity() { var tableResponse = JsonConvert.SerializeObject(_dbConnection.GetModelDetails(RawSQL.GetAllActCode())); return(Task.FromResult(JsonConvert.DeserializeObject <List <AllActivityCode> >(tableResponse))); }
public List <LocalityList> GetLocalityLists() { var tableResponse = JsonConvert.SerializeObject(_dbConnection.GetModelDetails(RawSQL.GetLocalityLists())); return(JsonConvert.DeserializeObject <List <LocalityList> >(tableResponse)); }