示例#1
0
 public TXSCustomerDetailView()
 {
     master     = new TxscustomerDetail();
     lstCountry = new List <TxscountryDetail>();
     lstCity    = new List <TxscityDetail>();
     lstAccount = new List <Txscoadetail>();
 }
示例#2
0
        public async Task <IActionResult> Customer(TXSCustomerDetailView obj, string Save, string Update, string CusActive)
        {
            var user = await _userManager.GetUserAsync(User);

            if (User == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
            }
            if (Save != null)
            {
                obj.master.Id        = user.Id;
                obj.master.UserName  = user.UserName;
                obj.master.CusActive = (CusActive == "true") ? true : false;
                obj.master.EnterBy   = user.UserName;
                obj.master.EnterDate = System.DateTime.Now;
                db.TxscustomerDetail.Add(obj.master);
                db.SaveChanges();
            }
            if (Update != null)
            {
                TxscustomerDetail obj1 = new TxscustomerDetail();
                obj1 = db.TxscustomerDetail.Where(x => x.Id == user.Id && x.UserName == user.UserName && x.CusId == obj.master.CusId).FirstOrDefault();
                if (obj1 != null)
                {
                    obj1.CusType    = obj.master.CusType;
                    obj1.CusName    = obj.master.CusName;
                    obj1.CusAbbr    = obj.master.CusAbbr;
                    obj1.CusPerson  = obj.master.CusPerson;
                    obj1.CusAddress = obj.master.CusAddress;
                    obj1.CusPhNo    = obj.master.CusPhNo;
                    obj1.CusFaxNo   = obj.master.CusFaxNo;
                    obj1.CusEmail   = obj.master.CusEmail;
                    obj1.CusNtn     = obj.master.CusNtn;
                    obj1.CusStrn    = obj.master.CusStrn;
                    obj1.CusCity    = obj.master.CusCity;
                    obj1.CusCountry = obj.master.CusCountry;
                    obj1.CusDesc    = obj.master.CusDesc;
                    obj1.CusCrDays  = obj.master.CusCrDays;
                    obj1.CusActive  = (CusActive == "true") ? true : false;
                    obj1.EditBy     = user.UserName;
                    obj1.EditDate   = System.DateTime.Now;
                    db.SaveChanges();
                }
            }
            return(RedirectToAction("showCustomer"));
        }