public ActionResult SavePracticeInfo(PracticeInfo model) { SupervisorAuditModel models = new SupervisorAuditModel(); models.InsertPracticeInfo(model); return(Json(new {}, JsonRequestBehavior.AllowGet)); }
public SingleResponeMessage <PracticeInfo> Get(string id) { SingleResponeMessage <PracticeInfo> ret = new SingleResponeMessage <PracticeInfo>(); try { PracticeInfo item = PracticeService.GetInstance().GetDetail(id); if (item == null) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = "no User found"; return(ret); } ret.item = item; ret.isSuccess = true; } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public List <PracticeInfo> GetUser(SqlConnection connection, string id, PracticeCriteria criteria) { var result = new List <PracticeInfo>(); using (var command = new SqlCommand("Select ltrim(rtrim(ID)) as ID, Name " + " from dbo.test where id=@id" + " where 1=1", connection)) { AddSqlParameter(command, "@id", id, System.Data.SqlDbType.VarChar); if (criteria.pageSize == 0) { criteria.pageSize = 10; } var offSet = criteria.pageIndex * criteria.pageSize; command.CommandText += " order by U.Name "; command.CommandText += " OFFSET @OFFSET ROWS FETCH NEXT @PAGESIZE ROWS ONLY "; AddSqlParameter(command, "@OFFSET", offSet, System.Data.SqlDbType.Int); AddSqlParameter(command, "@PAGESIZE", criteria.pageSize, System.Data.SqlDbType.Int); WriteLogExecutingCommand(command); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var info = new PracticeInfo(); info.UserName = GetDbReaderValue <string>(reader["Name"]); info.UserID = GetDbReaderValue <string>(reader["ID"]); // info.Disable = GetDbReaderValue<byte>(reader["GroupID"]); result.Add(info); } } return(result); } }
public async Task <string> AddPractice(PracticeInfo practiceInfo) { try { PracticeInfo respractice = await _practiceMgmntDBContext.PracticeInfo.AsNoTracking().Where(x => x.PracticeId == practiceInfo.PracticeId || x.PracticeName == practiceInfo.PracticeName || x.EmailId == practiceInfo.EmailId || x.GST == practiceInfo.GST).FirstOrDefaultAsync(); if (respractice == null && Regex.IsMatch(practiceInfo.GST, "^[a-zA-Z][a-zA-Z0-9]*$") && practiceInfo.GST.Length == 15) { practiceInfo.CreatedDate = DateTime.Now; practiceInfo.ModifiedDate = DateTime.Now; practiceInfo.ActiveFlg = 1; practiceInfo.CreatedBy = practiceInfo.PracticeId; _practiceMgmntDBContext.PracticeInfo.AddRange(practiceInfo); await _practiceMgmntDBContext.SaveChangesAsync(); return("Practice added successfully"); } return("Unable to add practice:Enter valid details"); } catch (Exception ex) { Logger.Addlog(ex, "Practice"); return("Unable to add Practice"); } }
public void UpdateUser(PracticeInfo _user) { SqlConnectionFactory sqlConnection = new SqlConnectionFactory(); PracticeLogInfo record = new PracticeLogInfo(); using (SqlConnection connection = sqlConnection.GetConnection()) { PracticeDataLayer.GetInstance().UpdateUser(connection, _user); } }
public PracticeInfo GetDetail(string id) { SqlConnectionFactory sqlConnection = new SqlConnectionFactory(); PracticeInfo record = new PracticeInfo(); using (SqlConnection connection = sqlConnection.GetConnection()) { record = PracticeDataLayer.GetInstance().GetUser(connection, id); return(record); } }
public void UpdateUser(SqlConnection connection, PracticeInfo user) { using (var command = new SqlCommand("update dbo.test " + " SET Name=@UserName " + "where ID=@UserId " , connection)) { AddSqlParameter(command, "@UserID", user.UserID, System.Data.SqlDbType.NVarChar); AddSqlParameter(command, "@UserName", user.UserName, System.Data.SqlDbType.NVarChar); WriteLogExecutingCommand(command); command.ExecuteScalar(); } }
public void CreateConfirm(ConfirmInfo value) { SqlConnectionFactory sqlConnection = new SqlConnectionFactory(); PracticeInfo record = new PracticeInfo(); using (SqlConnection connection = sqlConnection.GetConnection()) { //string applicationId = EncryptionUtils.GetApplicationId(); //string applicationName = EncryptionUtils.GetApplicationName(); PracticeDataLayer.GetInstance().CreateConfirm(connection, value); } }
public void CreateUser(SqlConnection connection, PracticeInfo user) { using (var command = new SqlCommand("Insert into dbo.test " + " (ID ,Name)" + "VALUES " + "(@ID,@Name) ", connection)) { AddSqlParameter(command, "@ID", user.UserID, System.Data.SqlDbType.NVarChar); AddSqlParameter(command, "@Name", user.UserName, System.Data.SqlDbType.NVarChar); WriteLogExecutingCommand(command); command.ExecuteScalar(); } }
public async Task <PracticeInfo> ViewPracticeById(int practiceId) { try { PracticeInfo respractice = await _practiceMgmntDBContext.PracticeInfo.AsNoTracking().Where(x => x.PracticeId == practiceId).FirstOrDefaultAsync(); return(respractice); } catch (Exception ex) { Logger.Addlog(ex, "Practice"); throw ex; } }
public void AddPractice(PracticeInfo practice) { try { CashFlowManagerEntities db = new CashFlowManagerEntities(); if (practice.Id == Guid.Empty) practice.Id = Guid.NewGuid(); db.Practices.Add(practice.ToEntity<Practice>()); db.SaveChanges(); } catch (Exception ex) { Debug.WriteLine(ex.Message); throw; } }
public ActionMessage Put([FromBody] PracticeInfo model) { ActionMessage ret = new ActionMessage(); ret.isSuccess = true; try { PracticeService.GetInstance().UpdateUser(model); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public PracticeInfo GetUser(SqlConnection connection, string strUser) { var info = new PracticeInfo(); using (var command = new SqlCommand("Select id, name" + " from dbo.test where id=@id", connection)) { AddSqlParameter(command, "@id", strUser, System.Data.SqlDbType.VarChar); var reader = command.ExecuteReader(); if (reader.Read()) { info.UserName = GetDbReaderValue <string>(reader["Name"]); info.UserID = GetDbReaderValue <string>(reader["ID"]); } return(info); } }
public async Task <string> ModifyPractice(PracticeInfo practiceInfo) { try { PracticeInfo respractice = await _practiceMgmntDBContext.PracticeInfo.AsNoTracking().Where(x => x.PracticeId == practiceInfo.PracticeId || x.PracticeName == practiceInfo.PracticeName).FirstOrDefaultAsync(); PracticeInfo existingInfo = await _practiceMgmntDBContext.PracticeInfo.AsNoTracking().Where(x => x.PracticeId != practiceInfo.PracticeId).FirstOrDefaultAsync(); if (respractice != null && respractice.ActiveFlg == 1 && Regex.IsMatch(practiceInfo.GST, "^[a-zA-Z][a-zA-Z0-9]*$") && practiceInfo.GST.Length == 15) { if (existingInfo.PracticeName != practiceInfo.PracticeName) { practiceInfo.CreatedDate = respractice.CreatedDate; practiceInfo.ModifiedDate = DateTime.Now; practiceInfo.ActiveFlg = respractice.ActiveFlg; _practiceMgmntDBContext.PracticeInfo.UpdateRange(practiceInfo); await _practiceMgmntDBContext.SaveChangesAsync(); //UserInfo user = new UserInfo(); //user.UserId = respractice.UserId; //user.UserName = practiceInfo.PracticeName; //user.EmailId = practiceInfo.EmailId; //user.Location = practiceInfo.LocationDetails; //user.GST = practiceInfo.GST; //var json = JsonConvert.SerializeObject(user); //ApiCall newCall = new ApiCall(); //newCall.HttpPostToApi(json, "https://localhost:44385/api/User/EditUser"); return("Practice modified successfully"); } else { return("Practice Name already exists"); } } return("Unable to Modify:Enter valid details"); } catch (Exception ex) { Logger.Addlog(ex, "Practice"); return("Error occurred while modifying Practice Details"); } }
public async Task <string> DeletePractice(int practiceId) { try { PracticeInfo respractice = _practiceMgmntDBContext.PracticeInfo.FirstOrDefault(x => x.PracticeId == practiceId); if (respractice != null) { _practiceMgmntDBContext.PracticeInfo.Remove(respractice); await _practiceMgmntDBContext.SaveChangesAsync(); return("Practice deleted successfully"); } return("The given practice does not exists"); } catch (Exception ex) { Logger.Addlog(ex, "Practice"); return("Unable to delete Practice"); } }
public async Task <string> AddPractice(PracticeInfo practice) => await _practiceManagementService.AddPractice(practice);
public void InsertPracticeInfo(PracticeInfo data) { data.CreateUser = ""; data.CreateDate = DateTime.Now; Data.PracticeInfo.Insert_PracticeInfo(data, null, new string[] { "ID" }); }
public async Task <string> AddPractice(PracticeInfo practiceInfo) { return(await _practiceManagementRepository.AddPractice(practiceInfo)); }