/// <summary> /// Delete single item by ChatID /// </summary> public bool Delete(int id) { using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[bot].[RefusalWorkflowStatus_Delete]"; dataManager.Add("@ChatId", SqlDbType.BigInt, ParameterDirection.Input, id); dataManager.ExecuteNonQuery(); } return(true); }
/// <summary> /// Add or update item /// </summary> public UsageLog AddEdit(UsageLog entity) { using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[logs].[UsageLog_AddEdit]"; dataManager.Add("@UserId", SqlDbType.Int, ParameterDirection.Input, entity.UserId); dataManager.Add("@ActionType", SqlDbType.Int, ParameterDirection.Input, (int)entity.ActionType); dataManager.Add("@PageUrl", SqlDbType.NVarChar, ParameterDirection.Input, entity.PageUrl); dataManager.Add("@OccurredOn", SqlDbType.DateTime, ParameterDirection.Input, entity.OccurredOn); dataManager.ExecuteNonQuery(); } return(entity); }
/// <summary> /// Add or update item /// </summary> public Error AddEdit(Error entity) { using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[logs].[Error_AddEdit]"; dataManager.Add("@UserId", SqlDbType.Int, ParameterDirection.Input, entity.UserId); dataManager.Add("@ErrorCode", SqlDbType.BigInt, ParameterDirection.Input, entity.ErrorCode); dataManager.Add("@ErrorMessage", SqlDbType.NVarChar, ParameterDirection.Input, entity.ErrorMessage); dataManager.Add("@StackTrace", SqlDbType.NVarChar, ParameterDirection.Input, entity.StackTrace); dataManager.ExecuteNonQuery(); } return(entity); }
/// <summary> /// Add or update item /// </summary> public Days AddEdit(Days entity) { using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[dbo].[Days_AddEdit]"; dataManager.Add("@UserId", SqlDbType.Int, ParameterDirection.Input, entity.UserId); dataManager.Add("@CountryId", SqlDbType.Int, ParameterDirection.Input, entity.CountryId); dataManager.Add("@CountryVisaId", SqlDbType.Int, ParameterDirection.Input, entity.CountryVisaId); dataManager.Add("@Days", SqlDbType.Int, ParameterDirection.Input, entity.DaysCount); dataManager.ExecuteNonQuery(); } return(entity); }
/// <summary> /// Get list /// </summary> public List <AppSettings> List() { var entities = new List <AppSettings>(); using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[conf].[AppSettings_List]"; dataManager.Add("@Xml", SqlDbType.Xml, ParameterDirection.Output); dataManager.ExecuteReader(); XElement xmlOut = XElement.Parse(dataManager["@Xml"].Value.ToString()); entities.UnpackXML(xmlOut); } return(entities); }
/// <summary> /// Get single item by key /// </summary> public AppSettings GetByKey(string key) { var entity = new AppSettings(); using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[conf].[AppSettings_GetByKey]"; dataManager.Add("@Key", SqlDbType.NVarChar, ParameterDirection.Input, key); dataManager.Add("@Xml", SqlDbType.Xml, ParameterDirection.Output); dataManager.ExecuteReader(); XElement xmlOut = XElement.Parse(dataManager["@Xml"].Value.ToString()); entity.UnpackXML(xmlOut.Element("AppSetting")); } return(entity); }
/// <summary> /// Add or update item (NOT IMPLEMENTED) /// </summary> public Error AddEdit(Error entity) { using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[bot].[Product_AddEdit]"; dataManager.Add("@ChatId", SqlDbType.BigInt, ParameterDirection.Input, entity.ChatId); dataManager.Add("@RefusalWorkflowStatusId", SqlDbType.Int, ParameterDirection.Input, (int)entity.RefusalWorkflowStatusId); dataManager.Add("@ErrorCode", SqlDbType.BigInt, ParameterDirection.Input, entity.ErrorCode); dataManager.Add("@ErrorMessage", SqlDbType.NVarChar, ParameterDirection.Input, entity.ErrorMessage); dataManager.Add("@StackTrace", SqlDbType.NVarChar, ParameterDirection.Input, entity.StackTrace); dataManager.ExecuteNonQuery(); } return(entity); }
/// <summary> /// Add or update item /// </summary> public Refusal AddEdit(Refusal entity) { using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[bot].[Refusal_AddEdit]"; dataManager.Add("@Id", SqlDbType.Int, ParameterDirection.Input, entity.Id); dataManager.Add("@RefusalTypeId", SqlDbType.Int, ParameterDirection.Input, entity.RefusalTypeId); dataManager.Add("@RefusalComment", SqlDbType.NVarChar, ParameterDirection.Input, entity.RefusalComment); dataManager.Add("@UserId", SqlDbType.Int, ParameterDirection.Input, entity.UserId); dataManager.Add("@ProductId", SqlDbType.Int, ParameterDirection.Input, entity.ProductId); entity.Id = (int)dataManager.ExecuteScalar(); } return(entity); }
/// <summary> /// Get list by filter /// </summary> public List <UserTrackingSchedule> List(UserTrackingSchedule entity) { var entities = new List <UserTrackingSchedule>(); using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[dbo].[UserTrackingSchedule_List]"; dataManager.Add("@UserId", SqlDbType.Int, ParameterDirection.Input, entity.UserId); dataManager.Add("@Xml", SqlDbType.Xml, ParameterDirection.Output); dataManager.ExecuteReader(); XElement xmlOut = XElement.Parse(dataManager["@Xml"].Value.ToString()); entities.UnpackXML(xmlOut); } return(entities); }
/// <summary> /// Get single item by ChatID /// </summary> public RefusalWorkflowStatus Get(int id) { var entity = new RefusalWorkflowStatus(); using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[bot].[RefusalWorkflowStatus_Get]"; dataManager.Add("@ChatId", SqlDbType.BigInt, ParameterDirection.Input, id); dataManager.Add("@Xml", SqlDbType.Xml, ParameterDirection.Output); dataManager.ExecuteReader(); XElement xmlOut = XElement.Parse(dataManager["@Xml"].Value.ToString()); entity.UnpackXML(xmlOut.Element("RefusalWorkflowStatus")); } return(entity); }
/// <summary> /// Get single item by QR code /// </summary> public Device GetByQr(string qrcode) { var entity = new Device(); using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[dbo].[Device_GetByOR]"; dataManager.Add("@QRCode", SqlDbType.NVarChar, ParameterDirection.Input, qrcode); dataManager.Add("@Xml", SqlDbType.Xml, ParameterDirection.Output); dataManager.ExecuteReader(); XElement xmlOut = XElement.Parse(dataManager["@Xml"].Value.ToString()); entity.UnpackXML(xmlOut.Element("Device")); } return(entity); }
/// <summary> /// Add or update item (NOT IMPLEMENTED) /// </summary> public Product AddEdit(Product entity) { var result = entity; using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[bot].[Product_AddEdit]"; dataManager.Add("@ProductBarcode", SqlDbType.NVarChar, ParameterDirection.Input, entity.ProductBarcode); var id = dataManager.ExecuteScalar(); result = Get((int)id); } return(result); }
/// <summary> /// Get single item (NOT IMPLEMENTED) /// </summary> public Product Get(int id) { var entity = new Product(); using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[bot].[Product_Get]"; dataManager.Add("@Id", SqlDbType.Int, ParameterDirection.Input, id); dataManager.Add("@Xml", SqlDbType.Xml, ParameterDirection.Output); dataManager.ExecuteReader(); XElement xmlOut = XElement.Parse(dataManager["@Xml"].Value.ToString()); entity.UnpackXML(xmlOut.Element("Product")); } return(entity); }
/// <summary> /// Get single item /// </summary> public UserTrackingSchedule Get(int id) { var entity = new UserTrackingSchedule(); using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[dbo].[UserTrackingSchedule_Get]"; dataManager.Add("@Id", SqlDbType.Int, ParameterDirection.Input, id); dataManager.Add("@Xml", SqlDbType.Xml, ParameterDirection.Output); dataManager.ExecuteReader(); XElement xmlOut = XElement.Parse(dataManager["@Xml"].Value.ToString()); entity.UnpackXML(xmlOut.Element("UserTrackingSchedule")); } return(entity); }
/// <summary> /// Get user by accesscode if the user is exist /// </summary> public User Login(string login) { var user = new User(); using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[auth].[User_Login]"; dataManager.Add("@UserName", SqlDbType.NVarChar, ParameterDirection.Input, login); dataManager.Add("@Xml", SqlDbType.Xml, ParameterDirection.Output); dataManager.ExecuteReader(); XElement xmlOut = XElement.Parse(dataManager["@Xml"].Value.ToString()); user.UnpackXML(xmlOut.Element("User")); } return(user); }
/// <summary> /// Get User by userid /// </summary> public User Get(int id) { var user = new User(); using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[auth].[User_Get]"; dataManager.Add("@Id", SqlDbType.Int, ParameterDirection.Input, id); dataManager.Add("@Xml", SqlDbType.Xml, ParameterDirection.Output); dataManager.ExecuteReader(); XElement xmlOut = XElement.Parse(dataManager["@Xml"].Value.ToString()); user.UnpackXML(xmlOut.Element("User")); } return(user); }
/// <summary> /// Add or update item /// </summary> public UserTrackingSchedule AddEdit(UserTrackingSchedule entity) { using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[dbo].[UserTrackingSchedule_AddEdit]"; dataManager.Add("@UserId", SqlDbType.Int, ParameterDirection.Input, entity.UserId); dataManager.Add("@ScheduledHours", SqlDbType.Int, ParameterDirection.Input, entity.ScheduledHours); dataManager.Add("@ScheduledDays", SqlDbType.Int, ParameterDirection.Input, entity.ScheduledDays); dataManager.Add("@ScheduledNotificationId", SqlDbType.NVarChar, ParameterDirection.Input, entity.ScheduledNotificationId); dataManager.Add("@Enabled", SqlDbType.Int, ParameterDirection.Input, entity.Enabled); dataManager.Add("@LastRun", SqlDbType.DateTime, ParameterDirection.Input, entity.LastRun); dataManager.ExecuteNonQuery(); } return(entity); }
/// <summary> /// Add or update item /// </summary> public Country AddEdit(Country entity) { using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[dict].[Country_AddEdit]"; dataManager.Add("@UserId", SqlDbType.Int, ParameterDirection.Input, entity.UserId); dataManager.Add("@Name", SqlDbType.NVarChar, ParameterDirection.Input, entity.Name); dataManager.Add("@Code", SqlDbType.NVarChar, ParameterDirection.Input, entity.Code); dataManager.Add("@FinancialPeriodDateStart", SqlDbType.DateTime, ParameterDirection.Input, entity.CountryFinancialPeriod.DateStart); dataManager.Add("@FinancialPeriodDateEnd", SqlDbType.DateTime, ParameterDirection.Input, entity.CountryFinancialPeriod.DateEnd); dataManager.Add("@IsDefault", SqlDbType.Bit, ParameterDirection.Input, entity.IsDefault); dataManager.ExecuteNonQuery(); } return(entity); }
/// <summary> /// Add or update item /// </summary> public RefusalWorkflowStatus AddEdit(RefusalWorkflowStatus entity) { var result = entity; using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[bot].[RefusalWorkflowStatus_AddEdit]"; dataManager.Add("@ChatId", SqlDbType.BigInt, ParameterDirection.Input, entity.ChatId); dataManager.Add("@ProcessStage", SqlDbType.Int, ParameterDirection.Input, (int)entity.ProcessStage); dataManager.Add("@UserId", SqlDbType.Int, ParameterDirection.Input, entity.UserId); dataManager.Add("@ProductId", SqlDbType.Int, ParameterDirection.Input, entity.ProductId); var id = dataManager.ExecuteScalar(); result = Get((int)id); } return(result); }
/// <summary> /// AddEdit User /// </summary> public User AddEdit(User entity) { using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[auth].[User_AddEdit]"; dataManager.Add("@UserName", SqlDbType.NVarChar, ParameterDirection.Input, entity.UserName); dataManager.Add("@FirstName", SqlDbType.NVarChar, ParameterDirection.Input, entity.FirstName); dataManager.Add("@LastName", SqlDbType.NVarChar, ParameterDirection.Input, entity.LastName); dataManager.Add("@MiddleName", SqlDbType.NVarChar, ParameterDirection.Input, entity.MiddleName); dataManager.Add("@EmployeeId", SqlDbType.BigInt, ParameterDirection.Input, entity.EmployeeId); dataManager.Add("@PhoneNumber", SqlDbType.NVarChar, ParameterDirection.Input, entity.PhoneNumber); dataManager.Add("@Email", SqlDbType.NVarChar, ParameterDirection.Input, entity.Email); dataManager.Add("@StoreId", SqlDbType.Int, ParameterDirection.Input, entity.StoreId); dataManager.Add("@Status", SqlDbType.Bit, ParameterDirection.Input, entity.Status); dataManager.ExecuteNonQuery(); } return(entity); }
/// <summary> /// Delete /// </summary> public bool Delete(int userId, int visaId) { bool result = true; try { using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[map].[UserCountryVisa_Delete]"; dataManager.Add("@UserId", SqlDbType.Int, ParameterDirection.Input, userId); dataManager.Add("@VisaId", SqlDbType.Int, ParameterDirection.Input, visaId); dataManager.ExecuteNonQuery(); } } catch (Exception) { result = false; } return(result); }
/// <summary> /// Add or update item /// </summary> public UserCountryVisa AddEdit(UserCountryVisa entity) { using (var dataManager = new DataManager.Implementation.DataManager(ConnectionString)) { dataManager.ExecuteString = "[map].[UserCountryVisa_AddEdit]"; dataManager.Add("@UserId", SqlDbType.Int, ParameterDirection.Input, entity.UserId); dataManager.Add("@CountryId", SqlDbType.Int, ParameterDirection.Input, entity.CountryId); dataManager.Add("@Name", SqlDbType.NVarChar, ParameterDirection.Input, entity.CountryVisa.Name); dataManager.Add("@Code", SqlDbType.NVarChar, ParameterDirection.Input, entity.CountryVisa.Code); dataManager.Add("@Description", SqlDbType.NVarChar, ParameterDirection.Input, entity.CountryVisa.Description); dataManager.Add("@DateStart", SqlDbType.DateTime, ParameterDirection.Input, entity.CountryVisa.DateStart); dataManager.Add("@DateEnd", SqlDbType.DateTime, ParameterDirection.Input, entity.CountryVisa.DateEnd); dataManager.Add("@CountFirstDay", SqlDbType.Bit, ParameterDirection.Input, entity.CountryVisa.CountFirstDay); dataManager.Add("@CountLastDay", SqlDbType.Bit, ParameterDirection.Input, entity.CountryVisa.CountLastDay); dataManager.Add("@TargetDays", SqlDbType.Int, ParameterDirection.Input, entity.CountryVisa.TargetDays); dataManager.Add("@SpecialTime", SqlDbType.NVarChar, ParameterDirection.Input, entity.CountryVisa.SpecialTime); dataManager.Add("@AllowNotification", SqlDbType.Bit, ParameterDirection.Input, entity.AllowNotification); dataManager.ExecuteNonQuery(); } return(entity); }