Ejemplo n.º 1
0
        public IActionResult Index()
        {
            var customerModel = new CustomerModel()
            {
                FirstName = "Kishor",
                LastName  = "Naik",
                Address   = new AddressModel()
                {
                    City   = "Thane",
                    State  = "Maharashtra",
                    Street = "Kalwa"
                }
            };

            var customerTableObj = mapper.Map <CustomerTable>(customerModel);

            var customerTable = new CustomerTable()
            {
                FirstName = "Kishor",
                LastName  = "Naik",
                City      = "Thane",
                State     = "Maharashtra",
                Street    = "Kalwa"
            };

            var customerModelObj = mapper.Map <CustomerModel>(customerTable);


            return(View());
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <string[]> customerRecord = CustomerTable.GetData(customerDGV, hideThicknessExt);

            _presenter.SetCustomer(customerRecord);
            SetMoluleThickness();
        }
Ejemplo n.º 3
0
        public ActionResult LoginPage(CustomerTable t)
        {
            string ANo  = Request.Form["txtnumber"].ToString();
            string Pass = Request.Form["txtpass"].ToString();
            var    data = db.CustomerTables.Where(x => x.AccNo == ANo && x.Password == Pass).SingleOrDefault();

            if (data == null)
            {
                ModelState.AddModelError("", "Login Inuccessful");
            }


            else
            {
                login = ANo;
                Session["LoginID"] = login;
                Session["ACCname"] = data.Name;

                ModelState.AddModelError("", "Login Successful");
                return(RedirectToAction("Links"));
            }


            return(View());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                signUpBtnMain.Visible = true;
                loginBtnMain.Visible  = true;

                logoutBtnMain.Visible = false;
                lblWelcomeMsg.Visible = false;
            }
            else
            {
                signUpBtnMain.Visible = false;
                loginBtnMain.Visible  = false;

                logoutBtnMain.Visible = true;
                lblWelcomeMsg.Visible = true;
            }

            if (!IsPostBack)
            {
                if (Session["user"] != null)
                {
                    DataContextDataContext objDataContext = new DataContextDataContext();
                    CustomerTable          objCustomer    = objDataContext.CustomerTables.Single(cus => cus.CustomerEmail == Session["user"]);
                    string cusName = objCustomer.CustomerName;

                    lblWelcomeMsg.Text = "Welcome back, " + cusName + "!";
                }
            }
        }
Ejemplo n.º 5
0
        private void customerTableButton_Click(object sender, EventArgs e)
        {
            CustomerTable aCustomerTable = new CustomerTable();

            aCustomerTable.Show();
            this.Hide();
        }
Ejemplo n.º 6
0
        private void FormCustomerEdit_Load(object sender, EventArgs e)
        {
            this.textBoxCredit.Text  = "0";
            this.textBoxVatRate.Text = "17";

            if (!m_isAdd)
            {
                this.buttonAdd.Enabled           = false;
                this.buttonCustomerGroup.Enabled = false;

                if (m_isEditCustomer)
                {
                    m_customer = Customer.getInctance().getCustomerInfoFromPkey(m_customerPkey);
                }
                else
                {
                    m_customerType    = CustomerType.getInctance().getCustomerTypeInfoFromPkey(m_customerGroupPkey);
                    m_isCustomerGroup = true;
                }

                setPageActiveState();
                setPageActiveValue();
            }

            // 初始化区域下拉框值
            ComboBoxExtend.initComboBox(this.comboBoxArea, "BASE_AREA_LIST");
        }
Ejemplo n.º 7
0
        private void btnStartTest_Click(object sender, EventArgs e)
        {
            IDatabase db = new Database("as400");

            // Use NPoco Query
            List<CustomerTable> customers = db.Fetch<CustomerTable>();
            customers.ForEach(c => Console.WriteLine(c.FirstName + @" - " + c.LastName));

            var u = new CustomerTable
            {
                FirstName = "Giulia",
                LastName = "Carbonci",
                PhoneNumber = 555555
            };

            db.Insert(u);

            u.LastName = "Carboni";
            db.Update(u);

            // Use NPoco Stored Procedure Extension
            Console.WriteLine(@"START USING PROCEDURE EXTENSION");

            var ts = new SPCustomerSelect { Key = 2 };
            IEnumerable<CustomerTable> storedResult = db.QueryStoredProcedure<CustomerTable, SPCustomerSelect>(ts);
            storedResult.ToList().ForEach(c => Console.WriteLine(c.FirstName + @" - " + c.LastName));
            Console.WriteLine(ts.ErrorMessage);
            db.CloseSharedConnection();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                string OriginalUrl  = HttpContext.Current.Request.RawUrl;
                string LoginPageUrl = "CustomerLogin.aspx";
                HttpContext.Current.Response.Redirect(String.Format("{0}?ReturnUrl={1}", LoginPageUrl, OriginalUrl));
            }

            calculateSum();
            if (PriceInTotal.Text == "0")
            {
                Label1.Visible = true;
            }
            else if (PriceInTotal.Text != "0")
            {
                Label2.Visible       = true;
                PriceInTotal.Visible = true;
                Button1.Visible      = true;
            }
            if (!IsPostBack)
            {
                if (Session["user"] == null)
                {
                    Response.Redirect("CustomerLogin.aspx");
                }
                else
                {
                    using (DataContextDataContext objDataContext = new DataContextDataContext())
                    {
                        CustomerTable objCustomer = objDataContext.CustomerTables.Single(cus => cus.CustomerEmail == Session["user"]);
                    }
                }
            }
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                string OriginalUrl  = HttpContext.Current.Request.RawUrl;
                string LoginPageUrl = "CustomerLogin.aspx";
                HttpContext.Current.Response.Redirect(String.Format("{0}?ReturnUrl={1}", LoginPageUrl, OriginalUrl));
            }

            if (!IsPostBack)
            {
                DataContextDataContext objDataContext = new DataContextDataContext();
                CustomerTable          objCustomer    = objDataContext.CustomerTables.Single(cus => cus.CustomerEmail == Session["user"]);
                string customerEmail = objCustomer.CustomerEmail;

                DataContextDataContext db = new DataContextDataContext();

                var queryWishList = from p in db.WishLists
                                    join o in db.ArtistUploads on p.productID equals o.productID
                                    join s in db.ArtistTables on o.authorEmail equals s.authorEmail
                                    where p.customerEmail == customerEmail && o.authorEmail == s.authorEmail
                                    select new
                { p.productID, p.wishListID, p.unitPrice, o.description, p.quantity, p.customerEmail, o.productname, o.artImage, o.authorEmail, s.authorName };

                DataList1.DataSource = queryWishList;
                DataList1.DataBind();

                if (DataList1.Items.Count == 0)
                {
                    emptyWishListMessage.Text    = "<br />" + "<h3>" + "You currently do not have any products in this wish list, kindly click " + "<a href=\"CustomerBrowse.aspx\">here</a>" + " to start browsing and add items into your wish list!" + "</h3>" + "<br />";
                    emptyWishListMessage.Visible = true;
                }
            }
        }
Ejemplo n.º 10
0
        public ActionResult Save(CustomerTable cus)
        {
            if (ModelState.IsValid)
            {
                using (OnboardingTaskEntities dc = new OnboardingTaskEntities())
                {
                    if (cus.customerId > 0)
                    {
                        //Edit
                        var v = dc.CustomerTables.Where(a => a.customerId == cus.customerId).FirstOrDefault();
                        if (v != null)
                        {
                            v.customerId = cus.customerId;

                            v.customerName    = cus.customerName;
                            v.customerAge     = cus.customerAge;
                            v.customerAddress = cus.customerAddress;
                        }
                    }
                    else
                    {
                        //Save
                        var customers = dc.CustomerTables.OrderBy(a => a.customerId).ToList();
                        dc.CustomerTables.Add(cus);
                    }
                    dc.SaveChanges();
                }
            }

            return(RedirectToAction("Index"));
        }
 public CustomeAdd()
 {
     InitializeComponent();
     controls = new Control[3] {
         tbName, tbSecondName, tbThirdName
     };
     classTableCustomer = new CustomerTable();
 }
Ejemplo n.º 12
0
        public async Task <CustomerTable> AddCustomer(CustomerTable customer)
        {
            await _unitOfWork.Customers.AddAsync(customer);

            await _unitOfWork.CommitAsync();

            return(customer);
        }
Ejemplo n.º 13
0
        public int Insert <T>(T entity)
        {
            Type type = entity.GetType();

            if (type == typeof(City))
            {
                return(CityTable.Insert(entity as City));
            }

            if (type == typeof(Customer))
            {
                return(CustomerTable.Insert(entity as Customer));
            }

            if (type == typeof(Distillation))
            {
                return(DistillationTable.Insert(entity as Distillation));
            }

            if (type == typeof(District))
            {
                return(DistrictTable.Insert(entity as District));
            }

            if (type == typeof(Material))
            {
                return(MaterialTable.Insert(entity as Material));
            }

            if (type == typeof(Period))
            {
                return(PeriodTable.Insert(entity as Period));
            }

            if (type == typeof(Region))
            {
                return(RegionTable.Insert(entity as Region));
            }

            if (type == typeof(Reservation))
            {
                return(ReservationTable.Insert(entity as Reservation));
            }

            if (type == typeof(Season))
            {
                return(SeasonTable.Insert(entity as Season));
            }

            if (type == typeof(UserInfo))
            {
                return(UserInfoTable.Insert(entity as UserInfo));
            }

            return(0);
        }
Ejemplo n.º 14
0
        public ICollection <T> SelectAll <T>(T type) where T : new()
        {
            Type entType = type.GetType();

            if (entType == typeof(City))
            {
                return((ICollection <T>)CityTable.Select());
            }

            if (entType == typeof(Customer))
            {
                return((ICollection <T>)CustomerTable.Select());
            }

            if (entType == typeof(Distillation))
            {
                return((ICollection <T>)DistillationTable.Select());
            }

            if (entType == typeof(District))
            {
                return((ICollection <T>)DistrictTable.Select());
            }

            if (entType == typeof(Material))
            {
                return((ICollection <T>)MaterialTable.Select());
            }

            if (entType == typeof(Period))
            {
                return((ICollection <T>)PeriodTable.Select());
            }

            if (entType == typeof(Region))
            {
                return((ICollection <T>)RegionTable.Select());
            }

            if (entType == typeof(Reservation))
            {
                return((ICollection <T>)ReservationTable.Select());
            }

            if (entType == typeof(Season))
            {
                return((ICollection <T>)SeasonTable.Select());
            }

            if (entType == typeof(UserInfo))
            {
                return((ICollection <T>)UserInfoTable.Select());
            }

            return(null);
        }
Ejemplo n.º 15
0
        public T Select <T>(T type, int primaryKey) where T : new()
        {
            Type entType = type.GetType();

            if (entType == typeof(City))
            {
                return((T)Convert.ChangeType(CityTable.Select(primaryKey), typeof(T)));
            }

            if (entType == typeof(Customer))
            {
                return((T)Convert.ChangeType(CustomerTable.Select(primaryKey), typeof(T)));
            }

            if (entType == typeof(Distillation))
            {
                return((T)Convert.ChangeType(DistillationTable.Select(primaryKey), typeof(T)));
            }

            if (entType == typeof(District))
            {
                return((T)Convert.ChangeType(DistrictTable.Select(primaryKey), typeof(T)));
            }

            if (entType == typeof(Material))
            {
                return((T)Convert.ChangeType(MaterialTable.Select(primaryKey), typeof(T)));
            }

            if (entType == typeof(Period))
            {
                return((T)Convert.ChangeType(PeriodTable.Select(primaryKey), typeof(T)));
            }

            if (entType == typeof(Region))
            {
                return((T)Convert.ChangeType(RegionTable.Select(primaryKey), typeof(T)));
            }

            if (entType == typeof(Reservation))
            {
                return((T)Convert.ChangeType(ReservationTable.Select(primaryKey), typeof(T)));
            }

            if (entType == typeof(Season))
            {
                return((T)Convert.ChangeType(SeasonTable.Select(primaryKey), typeof(T)));
            }

            if (entType == typeof(UserInfo))
            {
                return((T)Convert.ChangeType(UserInfoTable.Select(primaryKey), typeof(T)));
            }

            return(default(T));
        }
Ejemplo n.º 16
0
        public CustomerTable GetValid(int id = ID)
        {
            var customer = new CustomerTable();

            customer.Id      = id;
            customer.Name    = NAME;
            customer.Surname = SURNAME;

            return(customer);
        }
Ejemplo n.º 17
0
        public int DeleteCustomer(int Id)

        {
            int           count = 0;
            CustomerTable obj   = db.CustomerTables.First(e => e.Id == Id);

            db.CustomerTables.Remove(obj);
            count = db.SaveChanges();
            return(count);
        }
Ejemplo n.º 18
0
        public void DeleteCustomer(int storeId, String contact)
        {
            CustomerTable customer = customerEntities.CustomerTables.FirstOrDefault(e => e.StoreID == storeId && e.ContactNo == contact);

            if (customer != null)
            {
                customerEntities.CustomerTables.Remove(customer);
            }
            customerEntities.SaveChanges();
        }
Ejemplo n.º 19
0
        public CustomerTable updateGiftCard(String contact_no, int balance)
        {
            CustomerTable customer = customerEntities.CustomerTables.Where(e => e.ContactNo == contact_no).FirstOrDefault();

            if (customer != null)
            {
                customer.Load = balance;
            }
            customerEntities.SaveChanges();
            return(customer);
        }
Ejemplo n.º 20
0
 public object AddotrUpdatestudent(UserTable st)
 {
     try
     {
         if (st.Cid == null)
         {
             CustomerTable sm = new CustomerTable();
             sm.username         = st.username;
             sm.emailid          = st.emailid;
             sm.password         = st.password;
             sm.confirm_password = st.confirm_password;
             sm.gender           = st.gender;
             sm.city             = st.city;
             sm.nationality      = st.nationality;
             db.CustomerTables.Add(sm);
             db.SaveChanges();
             return(new Response
             {
                 Status = "Success",
                 Message = "Data Successfully"
             });
         }
         else
         {
             var obj = db.CustomerTables.Where(x => x.Cid == st.Cid).ToList().FirstOrDefault();
             if (obj.Cid != null)
             {
                 obj.username         = st.username;
                 obj.emailid          = st.emailid;
                 obj.mobileno         = st.mobileno;
                 obj.password         = st.password;
                 obj.confirm_password = st.confirm_password;
                 obj.gender           = st.gender;
                 obj.city             = st.city;
                 obj.nationality      = st.nationality;
                 db.SaveChanges();
                 return(new Response
                 {
                     Status = "Updated",
                     Message = "Updated Successfully"
                 });
             }
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex.Message);
     }
     return(new Response
     {
         Status = "Error",
         Message = "Data not insert"
     });
 }
Ejemplo n.º 21
0
        private void addCustomer()
        {
            CustomerTable customer = new CustomerTable();

            // 基本信息-基础信息
            customer.customerType = m_customerGroupPkey;
            customer.name         = this.textBoxName.Text.ToString();
            customer.nameShort    = this.textBoxShortName.Text.ToString();
            customer.mnemonicCode = this.textBoxMnemonicCode.Text.ToString();
            if (this.textBoxCredit.Text.ToString().Length == 0)
            {
                customer.credit = 0;
            }
            else
            {
                customer.credit = Convert.ToInt32(this.textBoxCredit.Text.ToString());
            }

            if (this.textBoxVatRate.Text.ToString().Length == 0)
            {
                customer.varRate = Convert.ToInt32(this.textBoxVatRate.Text.ToString());
            }
            else
            {
                // 增值税税率默认为17%
                customer.varRate = 17;
            }

            // 基础信息-银行信息
            customer.bankName    = this.textBoxBankName.Text.ToString();
            customer.bankAccount = this.textBoxBankAccount.Text.ToString();
            customer.taxAccount  = this.textBoxTaxAccount.Text.ToString();

            // 联系方式
            customer.area     = this.comboBoxArea.Text.ToString();
            customer.contact  = this.textBoxContact.Text.ToString();
            customer.tel      = this.textBoxTel.Text.ToString();
            customer.fax      = this.textBoxFax.Text.ToString();
            customer.homePage = this.textBoxHomePage.Text.ToString();
            customer.email    = this.textBoxEmail.Text.ToString();
            customer.address  = this.textBoxAddress.Text.ToString();
            customer.zipCode  = this.textBoxZipCode.Text.ToString();
            customer.note     = this.textBoxNote.Text.ToString();

            if (customer.name.Length == 0)
            {
                MessageBoxExtend.messageWarning("公司名称不能为空,请重新填写!");
                return;
            }

            Customer.getInctance().insert(customer);
        }
Ejemplo n.º 22
0
 public MainForm()
 {
     InitializeComponent();
     classTableWorker   = new WorkerTable(GridViewWorker);
     classTableService  = new ServiceTable(GridViewService);
     classTableCustomer = new CustomerTable(GridViewСustomers);
     groupTable         = new GroupTable(GridViewGroups);
     visitTable         = new VisitTable(GridViewVisitGroup);
     timetable          = new TimetableTable(GridViewTimeTable);
     recordGroup        = new RecordGroupTable(GridViewRecordGroups);
     timetable.DateDay  = SelectDate.Value;
     timetable.Room     = cbRoom.Text;
 }
Ejemplo n.º 23
0
        private void metroGrid3_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            List <CustomerTable> list = metroGrid3.DataSource as List <CustomerTable>;

            cu = list[e.RowIndex];
            Form5 f = new Form5(cu);

            f.Show();
        }
Ejemplo n.º 24
0
 public CustomerTable addCustomer(CustomerTable customer)
 {
     if (customer != null)
     {
         customerEntities.CustomerTables.Add(customer);
         customerEntities.SaveChanges();
         return(customer);
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 25
0
        public Boolean isExist(String contact_numb)
        {
            CustomerTable customer = customerEntities.CustomerTables.Where(e => e.ContactNo == contact_numb).FirstOrDefault();

            if (customer != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 26
0
        public CustomerTable updatePointCard(int id, int points, int reserved_amount, int rewards)
        {
            CustomerTable customer = customerEntities.CustomerTables.Where(e => e.ID == id).FirstOrDefault();

            if (customer != null)
            {
                customer.Points         = points;
                customer.ReservedAmount = reserved_amount;
                customer.Rewards        = rewards;
            }
            customerEntities.SaveChanges();
            return(customer);
        }
Ejemplo n.º 27
0
        public CustomerTable GetCustomer(int id)
        {
            CustomerTable customer = customerEntities.CustomerTables.FirstOrDefault(e => e.ID == id);

            if (customer != null)
            {
                return(customer);
            }
            else
            {
                return(null);
            }
        }
 // POST api/<controller>
 public HttpResponseMessage Post(CustomerTable c)
 {
     try
     {
         db.CustomerTables.Add(c);
         db.SaveChanges();
         return(new HttpResponseMessage(HttpStatusCode.Created));
     }
     catch
     {
         return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
     }
 }
Ejemplo n.º 29
0
        public CustomerTable GetSpecificCustomer(int store_id, String contact_number)
        {
            CustomerTable customer = customerEntities.CustomerTables.FirstOrDefault(e => e.StoreID == store_id && e.ContactNo == contact_number);

            if (customer != null)
            {
                return(customer);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 30
0
        public CustomerTable updateCustomer(int id, [FromBody] CustomerTable customer)
        {
            CustomerTable entity = customerEntities.CustomerTables.FirstOrDefault(e => e.ID == id);

            if (entity != null)
            {
                entity.Fname     = customer.Fname;
                entity.Lname     = customer.Lname;
                entity.ContactNo = customer.ContactNo;
                entity.Address   = customer.Address;
            }
            customerEntities.SaveChanges();
            return(entity);
        }
Ejemplo n.º 31
0
        public int UpdateCustomer(int Id, string CustomerName, string Age, string Email, string Address, string ImageUrl)

        {
            int           count = 0;
            CustomerTable obj   = db.CustomerTables.First(e => e.Id == Id);

            obj.CustomerName = CustomerName;
            obj.Age          = Age;
            obj.Email        = Email;
            obj.Address      = Address;
            obj.ImageUrl     = ImageUrl;
            count            = db.SaveChanges();
            return(count);
        }