public List <ENT.UserAndPlantMappingSUB> GetList(string search) { try { parFields.Clear(); QueryDisctionery.SelectPart = @"SELECT Distinct UserAndPlantMapping.AspNetUserID, AspNetUsers.UserName AS DisplayName "; QueryDisctionery.TablePart = @"FROM UserAndPlantMapping LEFT OUTER JOIN AspNetUsers ON UserAndPlantMapping.AspNetUserID = AspNetUsers.Id"; QueryDisctionery.OrderPart = " order by AspNetUsers.UserName desc"; if (!string.IsNullOrWhiteSpace(search)) { QueryDisctionery.ParameterPart = "where M.DisplayName like '%" + search + "%'"; } using (SqlDataReader dr = objDBHelper.ExecuteReaderQuery(QueryDisctionery, parFields, objEntity)) { lstEntity = COM.DBHelper.CopyDataReaderToEntity <ENT.UserAndPlantMappingSUB>(dr); objDBHelper.Disposed(); } } catch (Exception) { throw; } finally { parFields.Clear(); } return(lstEntity); }
public List <ENT.MainDeviceMasterSUB> CheckDuplicate(List <Guid> ParentID, COM.MyEnumration.MasterType mstType, string DeviceName) { try { if (mstType == COM.MyEnumration.MasterType.MainDeviceMaster) { QueryDisctionery.SelectPart = "SELECT TOP 1 DeviceId"; QueryDisctionery.TablePart = @"FROM MainDeviceMaster "; QueryDisctionery.ParameterPart += " WHERE DeviceName ='" + DeviceName + "' "; } using (SqlDataReader dr = objDBHelper.ExecuteReaderQuery(QueryDisctionery, parFields, objEntity)) { lstEntity = COM.DBHelper.CopyDataReaderToEntity <ENT.MainDeviceMasterSUB>(dr); objDBHelper.Disposed(); } } catch { throw; } finally { parFields.Clear(); } return(lstEntity); }
public List <ENT.PlantDeviceLastStatus> GetList() { try { parFields.Clear(); //Add Condition Parameters to dictionery //parFields.Add(COM.HelperMethod.PropertyName<ENT.UserProfile>(x => x.usr_id), userid, COM.Enumration.Operators.WHERE); //Add Query in to string builder object QueryDisctionery.SelectPart = "select * "; QueryDisctionery.TablePart = @"from PlantDeviceLastStatus "; //Execute Query and get SQLDataReader using (SqlDataReader dr = objDBHelper.ExecuteReaderQuery(QueryDisctionery, parFields, objEntity)) { lstEntity = COM.DBHelper.CopyDataReaderToEntity <ENT.PlantDeviceLastStatus>(dr); objDBHelper.Disposed(); } } catch (Exception) { throw; } finally { parFields.Clear(); } return(lstEntity); }
public List <ENT.OTPCodeMaster> GetVerifyOTP(string UserID, string OTPCode) { List <ENT.OTPCodeMaster> lstUserInfo = new List <Entity.OTPCodeMaster>(); try { parFields.Clear(); QueryDisctionery.SelectPart = "SELECT * "; QueryDisctionery.TablePart = "FROM OTPCodeMaster "; QueryDisctionery.ParameterPart = "WHERE DATEDIFF (minute, SystemDateTime,getdate()) <= 45 AND otp_user_id = '" + UserID + "' AND otp_code = " + Convert.ToInt32(OTPCode) + " "; QueryDisctionery.OrderPart = " ORDER BY SystemDateTime Desc"; using (SqlDataReader dr = objDBHelper.ExecuteReaderQuery(QueryDisctionery, parFields, objEntity)) { lstUserInfo = COM.DBHelper.CopyDataReaderToEntity <ENT.OTPCodeMaster>(dr); objDBHelper.Disposed(); } } catch (Exception) { throw; } finally { parFields.Clear(); } return(lstUserInfo); }