コード例 #1
0
 public bool AddRequestCustomerAccountData(tbl_Request_Customer_Accounts row)
 {
     try
     {
         using (var db = new SoneriCISEntities())
         {
             db.tbl_Request_Customer_Accounts.Add(row);
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #2
0
 public bool UpdateCustomerRequestAccount(tbl_Request_Customer_Accounts row)
 {
     try
     {
         using (var db = new SoneriCISEntities())
         {
             tbl_Request_Customer_Accounts val = new DAL.tbl_Request_Customer_Accounts();
             val                     = db.tbl_Request_Customer_Accounts.Where(a => a.ID == row.ID).FirstOrDefault();
             val.ID                  = row.ID;
             val.AccountNo           = row.AccountNo;
             val.CIF                 = row.CIF;
             val.CardNo              = row.CardNo;
             val.AccountStatusActive = row.AccountStatusActive;
             val.Salutation          = row.Salutation;
             val.AccountTitle        = row.AccountTitle;
             val.Address             = row.Address;
             val.Mobile              = row.Mobile;
             val.DateofBirth         = row.DateofBirth;
             val.MotherMaidenName    = row.MotherMaidenName;
             val.Identification      = row.Identification;
             val.CNIC                = row.CNIC;
             val.AddressType         = row.AddressType;
             val.AccountTypeID       = row.AccountTypeID;
             val.WaiveCharges        = row.WaiveCharges;
             val.PassportNo          = row.PassportNo;
             val.LandlineNo          = row.LandlineNo;
             val.Email               = row.Email;
             val.Nationality         = row.Nationality;
             val.AccountCategoryCode = row.AccountCategoryCode;
             val.PhoneOffice         = row.PhoneOffice;
             val.Company             = row.Company;
             val.IdentificationType  = row.IdentificationType;
             val.Mobile2             = row.Mobile2;
             val.Address2            = row.Address2;
             val.Address3            = row.Address3;
             val.MainMobile          = row.MainMobile;
             val.MainLandline        = row.MainLandline;
             val.MainAddress         = row.MainAddress;
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #3
0
        //public static string GetLinkedAccounts()
        //{

        //}

        public static bool AddRequestCustomerAccount(RequestVM request, string AddressValue, string MobileValue, string LandlineValue, string OfficePhoneValue)
        {
            try
            {
                //Check if Request Cust Account already exists
                tbl_Request_Customer_Accounts row1 = new CustomerRequestAccountDataAccess().GetRequestCustomerAccountByRequestId(int.Parse(request.ID.ToString()));

                request.MainAddress  = !string.IsNullOrEmpty(request.MainAddress) ? request.MainAddress.Replace("\n", " ") : string.Empty;
                request.MainLandline = !string.IsNullOrEmpty(request.MainLandline) ? request.MainLandline.Replace("\n", " ") : string.Empty;
                request.MainMobile   = !string.IsNullOrEmpty(request.MainMobile) ? request.MainMobile.Replace("\n", " ") : string.Empty;

                //string AddressValue = ""; string MobileValue = "";
                //string LandlineValue= ""; string OfficePhoneValue = "";


                var row = new tbl_Request_Customer_Accounts()
                {
                    AccountNo     = request.AccountNo,
                    CardNo        = request.CardNo,
                    AccountTypeID = request.AccountTypeId,
                    AccountTitle  = request.AccountTitle,
                    Address       = request.AccountAddress,

                    Address3    = request.CustomerAddress,
                    AddressType = request.AddressType,
                    LandlineNo  = request.LandlineNo,
                    MainAddress = request.MainAddress,

                    CNIC = request.CNIC,
                    //DateofBirth = !string.IsNullOrEmpty(request.DateofBirth) ? Convert.ToDateTime(request.DateofBirth) : (DateTime?)null,

                    Email      = request.Email,
                    MainMobile = request.MainMobile,
                    Mobile     = request.MobileNo,
                    // Nationality = "PAKISTANI",
                    PassportNo       = request.PassportNo,
                    MotherMaidenName = request.MotherName,
                    Salutation       = request.Salutation,
                    PhoneOffice      = request.PhoneOff,
                    WaiveCharges     = request.Waive,
                    CIF            = request.CIFNo,
                    Identification = request.Identification,
                    RequestID      = request.ID

                                     //saving main values required for audit trail report Jul-19
                    , Address2     = AddressValue
                    , Mobile2      = MobileValue
                    , MainLandline = LandlineValue
                    , Company      = OfficePhoneValue
                };
                if (row.Identification == "PoR")
                {
                    row.Nationality = "AF";
                }

                else
                {
                    row.Nationality = "PK";
                }



                if (row1 != null)
                {
                    return(new CustomerRequestAccountDataAccess().UpdateCustomerRequestAccount(row));
                }
                else
                {
                    return(new CustomerRequestAccountDataAccess().AddRequestCustomerAccountData(row));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }