public DataResult <MembersDetail> UpdateEmail(MembersDetail objMembersDetail) { DataResult <MembersDetail> Result = new DataResult <MembersDetail>(); try { using (var db = new SocietyDBEntities()) { //var transaction = db.Database.BeginTransaction(); MembersDetail objMember = db.MembersDetails.Where(x => x.memberId == objMembersDetail.memberId && x.societyId == objMembersDetail.societyId).FirstOrDefault(); if (objMember != null) { objMember.email = objMembersDetail.email; db.Entry(objMember).State = System.Data.EntityState.Modified; db.SaveChanges(); } else { Result.Message = "Member Not Found."; Result.MsgType = "E"; } } } catch (Exception ex) { Result.Message = ex.Message; Result.MsgType = "E"; } return(Result); }
public DataResult <NumRange> GetNumRange(string NumRangeCode) { try { using (var db = new SocietyDBEntities()) { NumRange objNumRange = db.NumRanges.Where(x => x.numRangeCode == NumRangeCode && x.isDeleted == false).FirstOrDefault(); if (objNumRange != null) { var NewNumber = objNumRange.currentNumber + 1; if (NewNumber > objNumRange.startNumber && NewNumber < objNumRange.endNumber) { objNumRange.currentNumber = NewNumber; db.Entry(objNumRange).State = System.Data.EntityState.Modified; db.SaveChanges(); var NewNumberString = NewNumber.ToString().PadLeft(8, '0'); NewNumberString = NumRangeCode + NewNumberString; Result.StringResult = NewNumberString; Result.Message = "NumRange Generated Successfully."; Result.MsgType = "S"; } else { Result.Message = "Numrange Exceeds.Kindly Contact Administration."; Result.MsgType = "E"; } } else { Result.Message = "Numrange Not Found.Kindly Contact Administration."; Result.MsgType = "E"; } } } catch (Exception ex) { Result.Message = ex.Message; Result.MsgType = "E"; } return(Result); }