Пример #1
0
        public ReturnObjValueBackEnd SearchBankBranchesByCondition(ChiNhanhNganHang sc)
        {
            List <ChiNhanhNganHang> lst = new List <ChiNhanhNganHang>();

            retObjValueBackEnd = new ReturnObjValueBackEnd();

            try
            {
                var ctx   = new BankingContext();
                var query = from ct in ctx.ChiNhanhNganHang
                            select ct;

                if (sc != null)
                {
                    if (sc.MaCN != null)
                    {
                        query = query.Where(p => p.MaCN.Equals(sc.MaCN));
                    }

                    if (sc.LoaiCN != null)
                    {
                        query = query.Where(p => p.LoaiCN.Equals(sc.LoaiCN));
                    }

                    if (sc.DTNoiBo != null)
                    {
                        query = query.Where(p => p.DTNoiBo.Equals(sc.DTNoiBo));
                    }

                    if (sc.TenCN != null)
                    {
                        query = query.Where(p => p.TenCN.Contains(sc.TenCN));
                    }

                    if (sc.DiaChi != null)
                    {
                        query = query.Where(p => p.DiaChi.Contains(sc.DiaChi));
                    }

                    if (sc.LoaiNH != null)
                    {
                        query = query.Where(p => p.LoaiNH.Equals(sc.LoaiNH));
                    }
                }

                lst = query.ToList();
                retObjValueBackEnd.Success = true;
                retObjValueBackEnd.Data    = lst.ToArray();
                return(retObjValueBackEnd);
            }
            catch (Exception ex)
            {
                retObjValueBackEnd.Success = false;
                retObjValueBackEnd.Message = ex.ToString();
                return(retObjValueBackEnd);

                throw ex;
            }
        }
Пример #2
0
 public void UpdateBankBranches(ChiNhanhNganHang objUpdate)
 {
     try
     {
         var ctx = new BankingContext();
         ctx.Entry(objUpdate).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
 public void InsertBankBranches(ChiNhanhNganHang objInsert)
 {
     try
     {
         var ctx = new BankingContext();
         ctx.ChiNhanhNganHang.Add(objInsert);
         ctx.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #4
0
        public List <ChiNhanhNganHang> SearchBankBranchesByCondition(ChiNhanhNganHang sc)
        {
            List <ChiNhanhNganHang> lst = new List <ChiNhanhNganHang>();

            try
            {
                var ctx   = new BankingContext();
                var query = from ct in ctx.ChiNhanhNganHang
                            select ct;

                if (sc != null)
                {
                    if (sc.MaCN != null)
                    {
                        query = query.Where(p => p.MaCN.Equals(sc.MaCN));
                    }

                    if (sc.LoaiCN != null)
                    {
                        query = query.Where(p => p.LoaiCN.Equals(sc.LoaiCN));
                    }

                    if (sc.DTNoiBo != null)
                    {
                        query = query.Where(p => p.DTNoiBo.Equals(sc.DTNoiBo));
                    }

                    if (sc.TenCN != null)
                    {
                        query = query.Where(p => p.TenCN.Contains(sc.TenCN));
                    }

                    if (sc.DiaChi != null)
                    {
                        query = query.Where(p => p.DiaChi.Contains(sc.DiaChi));
                    }

                    if (sc.LoaiNH != null)
                    {
                        query = query.Where(p => p.LoaiNH.Equals(sc.LoaiNH));
                    }
                }

                lst = query.ToList();
                return(lst);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #5
0
        public ReturnObjValueBackEnd InsertBankBranches(ChiNhanhNganHang objInsert)
        {
            retObjValueBackEnd = new ReturnObjValueBackEnd();

            try
            {
                var ctx = new BankingContext();
                ctx.ChiNhanhNganHang.Add(objInsert);
                ctx.SaveChanges();
                retObjValueBackEnd.Success = true;
                return(retObjValueBackEnd);
            }
            catch (Exception ex)
            {
                retObjValueBackEnd.Success = false;
                retObjValueBackEnd.Message = ex.ToString();
                return(retObjValueBackEnd);

                throw ex;
            }
        }
Пример #6
0
        public ReturnObjValueBackEnd UpdateBankBranches(ChiNhanhNganHang objUpdate)
        {
            retObjValueBackEnd = new ReturnObjValueBackEnd();

            try
            {
                var ctx = new BankingContext();
                ctx.Entry(objUpdate).State = System.Data.Entity.EntityState.Modified;
                ctx.SaveChanges();
                retObjValueBackEnd.Success = true;
                return(retObjValueBackEnd);
            }
            catch (Exception ex)
            {
                retObjValueBackEnd.Success = false;
                retObjValueBackEnd.Message = ex.ToString();
                return(retObjValueBackEnd);

                throw ex;
            }
        }