コード例 #1
0
        public ActionResult SavePracticeInfo(PracticeInfo model)
        {
            SupervisorAuditModel models = new SupervisorAuditModel();

            models.InsertPracticeInfo(model);
            return(Json(new {}, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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");
            }
        }
コード例 #5
0
ファイル: PracticeService.cs プロジェクト: yeupanhmaj/TMHH
        public void UpdateUser(PracticeInfo _user)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();
            PracticeLogInfo      record        = new PracticeLogInfo();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                PracticeDataLayer.GetInstance().UpdateUser(connection, _user);
            }
        }
コード例 #6
0
ファイル: PracticeService.cs プロジェクト: yeupanhmaj/TMHH
        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);
            }
        }
コード例 #7
0
 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();
     }
 }
コード例 #8
0
ファイル: PracticeService.cs プロジェクト: yeupanhmaj/TMHH
        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);
            }
        }
コード例 #9
0
 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();
     }
 }
コード例 #10
0
        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;
            }
        }
コード例 #11
0
        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;
            }
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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);
            }
        }
コード例 #14
0
        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");
            }
        }
コード例 #15
0
        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);
コード例 #17
0
 public void InsertPracticeInfo(PracticeInfo data)
 {
     data.CreateUser = "";
     data.CreateDate = DateTime.Now;
     Data.PracticeInfo.Insert_PracticeInfo(data, null, new string[] { "ID" });
 }
コード例 #18
0
 public async Task <string> AddPractice(PracticeInfo practiceInfo)
 {
     return(await _practiceManagementRepository.AddPractice(practiceInfo));
 }