Пример #1
0
        public ActionResult Create()
        {
            BankBranchModel model = new BankBranchModel();

            ser.FillDdl(model);
            return(View(model));
        }
Пример #2
0
        public IEnumerable <BankBranchModel> ListBankBranch()
        {
            var result = ent.BankBranches;
            List <BankBranchModel> model = new List <BankBranchModel>();

            foreach (var item in result)
            {
                BankBranchModel obj = new BankBranchModel
                {
                    BankBranchId         = item.BankBranchId,
                    BankId               = item.BankId,
                    BankName             = item.Banks.BankName,
                    CountryId            = item.CountryId,
                    Country              = item.Countries.CountryName,
                    BranchName           = item.BranchName,
                    BranchAddress        = item.BranchAddress,
                    PhoneNo              = item.PhoneNumber,
                    ContactPerson        = item.ContactPerson,
                    ContactPersonPhoneNo = item.ContactPersonPhoneNo,
                    ContactPersonEmail   = item.ContactPersonEmail
                };
                model.Add(obj);
            }
            return(model);
        }
Пример #3
0
        public ActionResult Index()
        {
            BankBranchModel model = new BankBranchModel();

            model.BankBranchList = ser.ListBankBranch();
            return(View(model));
        }
Пример #4
0
 public HttpResponseMessage DeleteBankBranch(BankBranchModel aBankBranchModel)
 {
     try
     {
         if (this.ModelState.IsValid)
         {
             var result = service.DeleteBankBranch(aBankBranchModel);
             if (result != null)
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, result));
             }
             else
             {
                 string message = "Not deleted successfully";
                 return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message));
             }
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
     }
 }
Пример #5
0
        public BankBranchModel FillDdl(BankBranchModel model)
        {
            GeneralProvider _gpro = new GeneralProvider();

            model.ddlCountriesList = new SelectList(_gpro.GetCountryList(), "CountryId", "CountryName");
            model.ddlBankList      = new SelectList(_gpro.GetBankList(), "BankId", "BankName");
            return(model);
        }
Пример #6
0
        public ActionResult Detail(int id)
        {
            BankBranchModel model = new BankBranchModel();

            model = ser.BankBranchDetail(id);

            return(View(model));
        }
Пример #7
0
        public ActionResult Edit(int Id)
        {
            BankBranchModel model = new BankBranchModel();

            model = ser.BankBranchDetail(Id);
            ser.FillDdl(model);
            model.BankBranchId = Id;

            return(View(model));
        }
Пример #8
0
        public ActionResult GetBankBranchView()
        {
            BankBranchModel model    = new BankBranchModel();
            var             BranchId = Request.QueryString["branchid"];

            try
            {
                Branchclient = new BankBranchServiceClient();
                BankBranchDto BBDto = Branchclient.GetById(BranchId != null ? Convert.ToInt32(BranchId) : 0);
                model.BranchId         = BBDto.BranchId;
                model.BaseBranchId     = BBDto.BaseBranchId;
                model.BranchAddress    = BBDto.BranchAddress;
                model.BranchContactNos = BBDto.BranchContactNos;
                model.BranchOfBank     = BBDto.BranchOfBank;
                model.CAId             = BBDto.CAId;
                model.Email1           = BBDto.Email1;
                model.Email2           = BBDto.Email2;

                model.FullDayBreakFromString = BBDto.FullDayBreakFrom != null?DateTime.ParseExact(BBDto.FullDayBreakFrom.Value.ToString(@"hh\:mm"), "HH:mm", null).ToString("hh:mm tt", CultureInfo.GetCultureInfo("en-US")) : "00:00 AM"; //Convert.ToInt32(BBDto.FullDayBreakFrom.Value.ToString(@"hh")) < 12 ? BBDto.FullDayBreakFrom.Value.ToString(@"hh\:mm") + Space + AM : BBDto.FullDayBreakFrom.Value.ToString(@"hh\:mm") + Space + PM : "00:00 AM";

                model.FullDayBreakToString = BBDto.FullDayBreakTo != null?DateTime.ParseExact(BBDto.FullDayBreakTo.Value.ToString(@"hh\:mm"), "HH:mm", null).ToString("hh:mm tt", CultureInfo.GetCultureInfo("en-US")) : "00:00 AM";       // Convert.ToInt32(BBDto.FullDayBreakTo.Value.ToString(@"hh")) < 12 ? BBDto.FullDayBreakTo.Value.ToString(@"hh\:mm") + Space + AM : BBDto.FullDayBreakTo.Value.ToString(@"hh\:mm") + Space + PM : "00:00 AM";

                model.FullDayTimeFromString = BBDto.FullDayTimeFrom != null?DateTime.ParseExact(BBDto.FullDayTimeFrom.Value.ToString(@"hh\:mm"), "HH:mm", null).ToString("hh:mm tt", CultureInfo.GetCultureInfo("en-US")) : "00:00 AM";    //Convert.ToInt32(BBDto.FullDayTimeFrom.Value.ToString(@"hh")) < 12 ? BBDto.FullDayTimeFrom.Value.ToString(@"hh\:mm") + Space + AM : BBDto.FullDayTimeFrom.Value.ToString(@"hh\:mm") + Space + PM : "00:00 AM";

                model.FullDayTimeToString = BBDto.FullDayTimeTo != null?DateTime.ParseExact(BBDto.FullDayTimeTo.Value.ToString(@"hh\:mm"), "HH:mm", null).ToString("hh:mm tt", CultureInfo.GetCultureInfo("en-US")) : "00:00 AM";          //Convert.ToInt32(BBDto.FullDayTimeTo.Value.ToString(@"hh")) < 12 ? BBDto.FullDayTimeTo.Value.ToString(@"hh\:mm") + Space + AM : BBDto.FullDayTimeTo.Value.ToString(@"hh\:mm") + Space + PM : "00:00 AM";

                model.HalfDayBreakFromString = BBDto.HalfDayBreakFrom != null?DateTime.ParseExact(BBDto.HalfDayBreakFrom.Value.ToString(@"hh\:mm"), "HH:mm", null).ToString("hh:mm tt", CultureInfo.GetCultureInfo("en-US")) : "00:00 AM"; //Convert.ToInt32(BBDto.HalfDayBreakFrom.Value.ToString(@"hh")) < 12 ? BBDto.HalfDayBreakFrom.Value.ToString(@"hh\:mm") + Space + AM : BBDto.HalfDayBreakFrom.Value.ToString(@"hh\:mm") + Space + PM : "00:00 AM";

                model.HalfDayBreakToString = BBDto.HalfDayBreakTo != null?DateTime.ParseExact(BBDto.HalfDayBreakTo.Value.ToString(@"hh\:mm"), "HH:mm", null).ToString("hh:mm tt", CultureInfo.GetCultureInfo("en-US")) : "00:00 AM";       //Convert.ToInt32(BBDto.HalfDayBreakTo.Value.ToString(@"hh")) < 12 ? BBDto.HalfDayBreakTo.Value.ToString(@"hh\:mm") + Space + AM : BBDto.HalfDayBreakTo.Value.ToString(@"hh\:mm") + Space + PM : "00:00 AM";

                model.HalfDayTimeFromString = BBDto.HalfDayTimeFrom != null?DateTime.ParseExact(BBDto.HalfDayTimeFrom.Value.ToString(@"hh\:mm"), "HH:mm", null).ToString("hh:mm tt", CultureInfo.GetCultureInfo("en-US")) : "00:00 AM";    //Convert.ToInt32(BBDto.HalfDayTimeFrom.Value.ToString(@"hh")) < 12 ? BBDto.HalfDayTimeFrom.Value.ToString(@"hh\:mm") + Space + AM : BBDto.HalfDayTimeFrom.Value.ToString(@"hh\:mm") + Space + PM : "00:00 AM";

                model.HalfDayTimeToString = BBDto.HalfDayTimeTo != null?DateTime.ParseExact(BBDto.HalfDayTimeTo.Value.ToString(@"hh\:mm"), "HH:mm", null).ToString("hh:mm tt", CultureInfo.GetCultureInfo("en-US")) : "00:00 AM";          //Convert.ToInt32(BBDto.HalfDayTimeTo.Value.ToString(@"hh")) < 12 ? BBDto.HalfDayTimeTo.Value.ToString(@"hh\:mm") + Space + AM : BBDto.HalfDayTimeTo.Value.ToString(@"hh\:mm") + Space + PM : "00:00 AM";

                model.IFSCCode      = BBDto.IFSCCode;
                model.MICRCode      = BBDto.MICRCode;
                model.Name          = BBDto.Name;
                model.SWIFTCode     = BBDto.SWIFTCode;
                model.WeeklyHalfDay = BBDto.WeeklyHalfDay;
                model.WeeklyOffDay  = BBDto.WeeklyOffDay;
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }
            finally
            {
                if (Branchclient != null)
                {
                    Branchclient.Close();
                }
            }
            return(View("AckAndClientCommonViews\\BankBranchView", model));
        }
Пример #9
0
 public ActionResult Create(BankBranchModel model)
 {
     try
     {
         ser.FillDdl(model);
         ser.CreateBankBranch(model);
     }
     catch
     {
     }
     return(RedirectToAction("Index"));
 }
Пример #10
0
        public ActionResult Edit(int Id, BankBranchModel model)
        {
            model.BankBranchId = Id;
            try
            {
                ser.EditBankBranch(model);
            }
            catch
            {
            }

            return(RedirectToAction("Index"));
        }
Пример #11
0
        private void CheckForValidation(BankBranchModel bankBranchModel)
        {
            if (String.IsNullOrEmpty(bankBranchModel.BranchAddress.PIN))
            {
                ModelState.AddModelError("errpin", ErrorAndValidationMessages.BBErrorRequiredPIN);
            }
            else
            {
                if (!Regex.IsMatch(bankBranchModel.BranchAddress.PIN, Constants.REGEXPIN))
                {
                    ModelState.AddModelError("errpin", ErrorAndValidationMessages.BBErrorRegExPIN);
                }
            }

            int bank = ComboBoxExtension.GetValue <object>("cmbBank") != null?ComboBoxExtension.GetValue <int>("cmbBank") : 0;

            if (bank == 0)
            {
                ModelState.AddModelError("errbank", ErrorAndValidationMessages.BBErrorRequiredBank);
            }

            if (String.IsNullOrEmpty(ComboBoxExtension.GetValue <object>("cmbCityVillage") != null ? ComboBoxExtension.GetValue <int>("cmbCityVillage").ToString() : null))
            {
                ModelState.AddModelError("errcity", ErrorAndValidationMessages.BBErrorRequiredCityVillage);
            }

            if (String.IsNullOrEmpty(bankBranchModel.BranchAddress.AddressLine1))
            {
                ModelState.AddModelError("erradd", ErrorAndValidationMessages.BBErrorRequiredAddressLine1);
            }

            if (bankBranchModel.BranchContactNos != null && bankBranchModel.BranchContactNos.Count > 0)
            {
                foreach (ContactDetailsDto cddto in bankBranchModel.BranchContactNos)
                {
                    if (!String.IsNullOrEmpty(cddto.ContactNo))
                    {
                        if (!Regex.IsMatch(cddto.ContactNo, @"\d{5,15}"))
                        {
                            ModelState.AddModelError("errcontact", ErrorAndValidationMessages.BBErrorRegExContactNo);
                            break;
                        }
                        if (!Regex.IsMatch(cddto.STDCode, @"\d{3,5}"))
                        {
                            ModelState.AddModelError("errcontact", ErrorAndValidationMessages.BBErrorRegExSTDCode);
                            break;
                        }
                    }
                }
            }
        }
Пример #12
0
        public void CreateBankBranch(BankBranchModel model)
        {
            BankBranches obj = new BankBranches
            {
                BankId               = model.BankId,
                CountryId            = model.CountryId,
                BranchName           = model.BranchName,
                BranchAddress        = model.BranchAddress,
                PhoneNumber          = model.PhoneNo,
                ContactPerson        = model.ContactPerson,
                ContactPersonPhoneNo = model.ContactPersonPhoneNo,
                ContactPersonEmail   = model.ContactPersonEmail
            };

            ent.AddToBankBranches(obj);
            ent.SaveChanges();
        }
Пример #13
0
 public HttpResponseMessage Post(BankBranchModel modelOfBankBranch)
 {
     try
     {
         bool save_bank_branch = bankBranchRepository.InsertBankBranch(modelOfBankBranch);
         var  formatter        = RequestFormat.JsonFormaterString();
         return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
             output = "success", msg = "Bank Branch save successfully"
         }, formatter));
     }
     catch (Exception ex)
     {
         var formatter = RequestFormat.JsonFormaterString();
         return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
             output = "error", msg = ex.ToString()
         }, formatter));
     }
 }
Пример #14
0
        //for edit
        public void EditBankBranch(BankBranchModel model)
        {
            BankBranches result = ent.BankBranches.Where(x => x.BankBranchId == model.BankBranchId).FirstOrDefault();

            result.BankBranchId         = model.BankBranchId;
            result.BankId               = model.BankId;
            result.CountryId            = model.CountryId;
            result.BranchName           = model.BranchName;
            result.BranchAddress        = model.BranchAddress;
            result.PhoneNumber          = model.PhoneNo;
            result.ContactPerson        = model.ContactPerson;
            result.ContactPersonPhoneNo = model.ContactPersonPhoneNo;
            result.ContactPersonEmail   = model.ContactPersonEmail;


            ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
            ent.SaveChanges();
        }
Пример #15
0
        public StronglyType.BankBranchModel GetByBankBranchModelId(long branchId)
        {
            try
            {
                var send = new BankBranchModel();

                var branch = _entities.bank_branch.SingleOrDefault(a => a.bank_branch_id == branchId);

                var list = _entities.bank_account.Where(a => a.bank_branch_id == branch.bank_branch_id).ToList();
                send.oBranch      = branch;
                send.oAccountList = list;

                return(send);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #16
0
        public BankBranchModel BankBranchDetail(int BankBranchId)
        {
            BankBranches    result = ent.BankBranches.Where(x => x.BankBranchId == BankBranchId).FirstOrDefault();
            BankBranchModel model  = new BankBranchModel();

            model.BankBranchId         = result.BankBranchId;
            model.BankId               = result.BankId;
            model.BankName             = result.Banks.BankName;
            model.CountryId            = result.CountryId;
            model.Country              = result.Countries.CountryName;
            model.BranchName           = result.BranchName;
            model.BranchAddress        = result.BranchAddress;
            model.PhoneNo              = result.PhoneNumber;
            model.ContactPerson        = result.ContactPerson;
            model.ContactPersonPhoneNo = result.ContactPersonPhoneNo;
            model.ContactPersonEmail   = result.ContactPersonEmail;

            return(model);
        }
Пример #17
0
 public ActionResult GetBanksView(BankBranchModel bankBranchModel)
 {
     SetBanksListToViewData();
     return(PartialView("Banks"));
 }
Пример #18
0
        public ActionResult AddBankBranchIndex()
        {
            BankBranchModel bankBranchModel = new BankBranchModel();

            Bankid = 0;
            Id     = null;
            string mode     = Request.QueryString["mode"] != null ? Request.QueryString["mode"].ToString() : string.Empty;
            var    BranchId = Request.QueryString["branchid"] != null ? Request.QueryString["branchid"] : null;

            Bankid = Request.QueryString["bankid"] != null?Convert.ToInt32(Request.QueryString["bankid"]) : 0;

            try
            {
                Branchclient = new BankBranchServiceClient();
                if (mode == "edit")
                {
                    BankBranchDto BBDto = Branchclient.GetById(BranchId != null ? Convert.ToInt32(BranchId) : 0);
                    FormMode = mode;
                    Id       = BBDto.BranchId;
                    bankBranchModel.BranchId         = BBDto.BranchId;
                    bankBranchModel.BaseBranchId     = BBDto.BaseBranchId;
                    bankBranchModel.BranchAddress    = BBDto.BranchAddress;
                    bankBranchModel.BranchContactNos = BBDto.BranchContactNos;
                    bankBranchModel.BranchOfBank     = BBDto.BranchOfBank;
                    Bankid = BBDto.BranchOfBank.BankId;
                    bankBranchModel.CAId   = BBDto.CAId;
                    bankBranchModel.Email1 = BBDto.Email1;
                    bankBranchModel.Email2 = BBDto.Email2;

                    bankBranchModel.FullDayBreakFrom = BBDto.FullDayBreakFrom;
                    bankBranchModel.FullDayBreakTo   = BBDto.FullDayBreakTo;
                    bankBranchModel.FullDayTimeFrom  = BBDto.FullDayTimeFrom;
                    bankBranchModel.FullDayTimeTo    = BBDto.FullDayTimeTo;
                    bankBranchModel.HalfDayBreakFrom = BBDto.HalfDayBreakFrom;
                    bankBranchModel.HalfDayBreakTo   = BBDto.HalfDayBreakTo;
                    bankBranchModel.HalfDayTimeFrom  = BBDto.HalfDayTimeFrom;
                    bankBranchModel.HalfDayTimeTo    = BBDto.HalfDayTimeTo;

                    bankBranchModel.IFSCCode      = BBDto.IFSCCode;
                    bankBranchModel.MICRCode      = BBDto.MICRCode;
                    bankBranchModel.Name          = BBDto.Name;
                    bankBranchModel.SWIFTCode     = BBDto.SWIFTCode;
                    bankBranchModel.WeeklyHalfDay = BBDto.WeeklyHalfDay;
                    bankBranchModel.WeeklyOffDay  = BBDto.WeeklyOffDay;
                    bankBranchModel.StateDistrictPlacesControlNames.HiddenFieldForCityVillageValue = BBDto.BranchAddress.CityVillage.CityVillageId;
                    bankBranchModel.StateDistrictPlacesControlNames.HiddenFieldForDistrictValue    = BBDto.BranchAddress.CityVillage.DistrictOfCityVillage.DistrictId;
                    bankBranchModel.StateDistrictPlacesControlNames.HiddenFieldForStateValue       = BBDto.BranchAddress.CityVillage.DistrictOfCityVillage.StateOfDistrict.StateId;

                    if (bankBranchModel.BranchContactNos == null || bankBranchModel.BranchContactNos.Count == 0)
                    {
                        bankBranchModel.BranchContactNos = new List <ContactDetailsDto>();
                    }
                }
                SetBanksListToViewData();
                ViewData["SelectedBank"] = bankBranchModel.BranchOfBank != null ? ((List <BankDto>)ViewData["BankList"]).FindIndex(FindBank) : 0;
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }
            finally
            {
                if (Branchclient != null)
                {
                    Branchclient.Close();
                }
            }

            return(View("AckAndClientCommonViews\\AddBankBranch", bankBranchModel));
        }
Пример #19
0
        public ActionResult AddBankBranch([ModelBinder(typeof(DevExpressEditorsBinder))] BankBranchModel bankBranchModel)
        {
            ViewData["Error"]   = null;
            TempData["Success"] = null;


            BankBranchDto bankBranchDto = new BankBranchDto();

            try
            {
                Bankid = 0;
                if (EditorExtension.GetValue <object>("cmbBank") != null)
                {
                    Bankid = EditorExtension.GetValue <int>("cmbBank");
                }
                bankBranchModel.BranchOfBank = new BankDto {
                    BankId = Bankid
                };
                if (bankBranchModel.BranchAddress != null)
                {
                    if (ComboBoxExtension.GetValue <object>("cmbCityVillage") != null)
                    {
                        int cityVillageID = ComboBoxExtension.GetValue <int>("cmbCityVillage");

                        bankBranchModel.BranchAddress.CityVillage = new CityVillageDto
                        {
                            CityVillageId = cityVillageID,
                        };
                    }
                }

                if (DateEditExtension.GetValue <object>("teFullDayFrom") != null)
                {
                    DateTime dt = DateEditExtension.GetValue <DateTime>("teFullDayFrom");
                    bankBranchModel.FullDayTimeFrom = bankBranchDto.FullDayTimeFrom = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
                }
                if (DateEditExtension.GetValue <object>("teFullDayTo") != null)
                {
                    DateTime dt = DateEditExtension.GetValue <DateTime>("teFullDayTo");
                    bankBranchModel.FullDayTimeTo = bankBranchDto.FullDayTimeTo = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
                }
                if (DateEditExtension.GetValue <object>("teFullDayBreakFrom") != null)
                {
                    DateTime dt = DateEditExtension.GetValue <DateTime>("teFullDayBreakFrom");
                    bankBranchModel.FullDayBreakFrom = bankBranchDto.FullDayBreakFrom = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
                }
                if (DateEditExtension.GetValue <object>("teFullDayBreakTo") != null)
                {
                    DateTime dt = DateEditExtension.GetValue <DateTime>("teFullDayBreakTo");
                    bankBranchModel.FullDayBreakTo = bankBranchDto.FullDayBreakTo = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
                }
                if (DateEditExtension.GetValue <object>("teHalfDayFrom") != null)
                {
                    DateTime dt = DateEditExtension.GetValue <DateTime>("teHalfDayFrom");
                    bankBranchModel.HalfDayTimeFrom = bankBranchDto.HalfDayTimeFrom = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
                }
                if (DateEditExtension.GetValue <object>("teHalfDayTo") != null)
                {
                    DateTime dt = DateEditExtension.GetValue <DateTime>("teHalfDayTo");
                    bankBranchModel.HalfDayTimeTo = bankBranchDto.HalfDayTimeTo = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
                }
                if (DateEditExtension.GetValue <object>("teHalfDayBreakFrom") != null)
                {
                    DateTime dt = DateEditExtension.GetValue <DateTime>("teHalfDayBreakFrom");
                    bankBranchModel.HalfDayBreakFrom = bankBranchDto.HalfDayBreakFrom = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
                }
                if (DateEditExtension.GetValue <object>("teHalfDayBreakTo") != null)
                {
                    DateTime dt = DateEditExtension.GetValue <DateTime>("teHalfDayBreakTo");
                    bankBranchModel.HalfDayBreakTo = bankBranchDto.HalfDayBreakTo = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
                }

                bankBranchModel.StateDistrictPlacesControlNames.HiddenFieldForCityVillageValue =
                    !String.IsNullOrEmpty(Request.Params[bankBranchModel.StateDistrictPlacesControlNames.PlacesComboName + "_VI"]) ?
                    Convert.ToInt32(Request.Params[bankBranchModel.StateDistrictPlacesControlNames.PlacesComboName + "_VI"]) : 0;
                bankBranchModel.StateDistrictPlacesControlNames.HiddenFieldForDistrictValue =
                    !String.IsNullOrEmpty(Request.Params[bankBranchModel.StateDistrictPlacesControlNames.DistrictComboName + "_VI"]) ?
                    Convert.ToInt32(Request.Params[bankBranchModel.StateDistrictPlacesControlNames.DistrictComboName + "_VI"]) : 0;
                bankBranchModel.StateDistrictPlacesControlNames.HiddenFieldForStateValue =
                    !String.IsNullOrEmpty(Request.Params[bankBranchModel.StateDistrictPlacesControlNames.StateComboName + "_VI"]) ?
                    Convert.ToInt32(Request.Params[bankBranchModel.StateDistrictPlacesControlNames.StateComboName + "_VI"]) : 0;

                CheckForValidation(bankBranchModel);

                if (ModelState.IsValid)
                {
                    UserDto currentUserDto = (UserDto)Session[Constants.SKCURRENTUSER];

                    if (bankBranchModel.BranchContactNos != null)
                    {
                        IList <ContactDetailsDto> NullContacts = bankBranchModel.BranchContactNos.Where(x => x.ContactNo == null).ToList();
                        if (NullContacts != null)
                        {
                            foreach (ContactDetailsDto contact in NullContacts)
                            {
                                bankBranchModel.BranchContactNos.Remove(contact);
                            }
                        }
                    }
                    bankBranchDto.BranchContactNos = bankBranchModel.BranchContactNos;
                    bankBranchDto.BranchAddress    = bankBranchModel.BranchAddress;
                    bankBranchDto.BranchOfBank     = bankBranchModel.BranchOfBank;

                    bankBranchDto.CAId   = Helper.GetCAIdOfUser(currentUserDto);
                    bankBranchDto.Name   = bankBranchModel.Name;
                    bankBranchDto.Email1 = bankBranchModel.Email1;
                    bankBranchDto.Email2 = bankBranchModel.Email2;

                    bankBranchDto.SWIFTCode = bankBranchModel.SWIFTCode;
                    bankBranchDto.MICRCode  = bankBranchModel.MICRCode;
                    bankBranchDto.IFSCCode  = bankBranchModel.IFSCCode;


                    bankBranchDto.ModifiedBy              = currentUserDto.UserId;
                    bankBranchDto.BranchOfBank.CreatedBy  = currentUserDto.UserId;
                    bankBranchDto.BranchOfBank.ModifiedBy = currentUserDto.UserId;


                    if (bankBranchDto.BranchContactNos != null && bankBranchDto.BranchContactNos.Count == 1)
                    {
                        if (bankBranchDto.BranchContactNos[0].ContactNo == null)
                        {
                            bankBranchDto.BranchContactNos.RemoveAt(0);
                        }
                    }

                    if (bankBranchModel.WeeklyOffDay != null)
                    {
                        bankBranchDto.WeeklyOffDay = new Common.Dto.WeeklyOffDaysDto
                        {
                            WeeklyOffDayId = bankBranchModel.WeeklyOffDay.WeeklyOffDayId,
                            IsSunday       = bankBranchModel.WeeklyOffDay.IsSunday,
                            IsMonday       = bankBranchModel.WeeklyOffDay.IsMonday,
                            IsTuesday      = bankBranchModel.WeeklyOffDay.IsTuesday,
                            IsWednesday    = bankBranchModel.WeeklyOffDay.IsWednesday,
                            IsThursday     = bankBranchModel.WeeklyOffDay.IsThursday,
                            IsFriday       = bankBranchModel.WeeklyOffDay.IsFriday,
                            IsSaturday     = bankBranchModel.WeeklyOffDay.IsSaturday
                        };
                    }

                    if (bankBranchModel.WeeklyHalfDay != null)
                    {
                        bankBranchDto.WeeklyHalfDay = new Common.Dto.WeeklyHalfDayDto
                        {
                            WeeklyHalfDayId = bankBranchModel.WeeklyHalfDay.WeeklyHalfDayId,
                            IsSunday        = bankBranchModel.WeeklyHalfDay.IsSunday,
                            IsMonday        = bankBranchModel.WeeklyHalfDay.IsMonday,
                            IsTuesday       = bankBranchModel.WeeklyHalfDay.IsTuesday,
                            IsWednesday     = bankBranchModel.WeeklyHalfDay.IsWednesday,
                            IsThursday      = bankBranchModel.WeeklyHalfDay.IsThursday,
                            IsFriday        = bankBranchModel.WeeklyHalfDay.IsFriday,
                            IsSaturday      = bankBranchModel.WeeklyHalfDay.IsSaturday
                        };
                    }

                    bool CreateBranchFlag = false;
                    if (Helper.IsCAIdNotNull(currentUserDto) && bankBranchModel.CAId == null && bankBranchModel.BaseBranchId == null)
                    {
                        if (Id != null && Id != 0)
                        {
                            bankBranchDto.BaseBranchId = Convert.ToInt32(Id);
                        }
                        CreateBranchFlag = true;
                    }
                    else
                    {
                        bankBranchDto.BaseBranchId = bankBranchModel.BaseBranchId;
                    }

                    Branchclient = new BankBranchServiceClient();
                    if (FormMode == "edit" && !CreateBranchFlag)
                    {
                        if (Id != null && Id != 0)
                        {
                            bankBranchDto.BranchId = Convert.ToInt32(Id);
                        }
                        bankBranchDto = Branchclient.Update(bankBranchDto, currentUserDto.UserName);
                    }
                    else
                    {
                        bankBranchDto.CreatedBy = currentUserDto.UserId;
                        bankBranchDto           = Branchclient.Create(bankBranchDto, currentUserDto.UserName);
                    }
                    if (bankBranchDto.Response.HasWarning)
                    {
                        ViewData["Error"] = string.Format(ErrorAndValidationMessages.BBRAddFailed, bankBranchModel.Name, bankBranchModel.BranchOfBank.BankName);
                    }
                    else
                    {
                        if (FormMode == "edit")
                        {
                            TempData["Success"] = string.Format(ClientResources.BankBranchUpdated, bankBranchDto.Name, bankBranchDto.BranchOfBank.BankName);
                        }
                        else
                        {
                            TempData["Success"] = string.Format(ClientResources.BankBranchAdded, bankBranchDto.Name, bankBranchDto.BranchOfBank.BankName);
                        }
                        FormMode = string.Empty;
                        return(RedirectToAction("BankBranchListIndex", "BankBranch"));
                    }
                }
            }
            catch (Exception ex)
            {
                return(View("ErrorPage"));
            }
            finally
            {
                if (Branchclient != null && Branchclient.State == System.ServiceModel.CommunicationState.Opened)
                {
                    Branchclient.Close();
                }
            }
            SetBanksListToViewData();
            ViewData["SelectedBank"] = Bankid != 0 ? ((List <BankDto>)ViewData["BankList"]).FindIndex(FindBank) : 0;
            return(View("AckAndClientCommonViews\\AddBankBranch", bankBranchModel));
        }
Пример #20
0
 public static BankBranch ToEntity(this BankBranchModel model, BankBranch destination)
 {
     return(AutoMapperConfiguration.Mapper.Map(model, destination));
 }
Пример #21
0
 public static BankBranch ToEntity(this BankBranchModel model)
 {
     return(AutoMapperConfiguration.Mapper.Map <BankBranchModel, BankBranch>(model));
 }