protected void Page_Load(object sender, EventArgs e)
    {
         EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
        if (e2.Designation.Equals("MARKETING MANAGER") || e2.Designation.Equals("MARKETING EMPLOYEE") || e2.Designation.Equals("MANAGING DIRECTOR") || e2.Designation.Equals("CHAIRMAN") || e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE") || e2.Designation.Equals("DESIGNER") || e2.Designation.Equals("EMPLOYEE"))
        {
            CustomerLogic cl = new CustomerLogic();
            Customer c1 = cl.SelectByID(Convert.ToInt32(Request.QueryString["id"]));

            if (c1 != null)
            {

                Label1.Text = c1.Name;
                Label2.Text = c1.Email;
                Label3.Text = c1.ContactPerson;
                Label4.Text = c1.Phone;
                Label5.Text = c1.OfficeAddress;
                Label6.Text = c1.DeliveryAddress;

                Label7.Text = c1.FactoryAddress;
                Label8.Text = c1.GodownAddress;
                Label9.Text = c1.OtherAddress;
                Label10.Text = c1.HeadOffice;
            }
        }
        else
        {
            Response.Redirect("Access.aspx");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
         EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
        if (e2.Designation.Equals("MARKETING MANAGER") || e2.Designation.Equals("MARKETING EMPLOYEE") || e2.Designation.Equals("MANAGING DIRECTOR") || e2.Designation.Equals("CHAIRMAN") || e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE") || e2.Designation.Equals("DESIGNER") || e2.Designation.Equals("EMPLOYEE"))
        {
             
            if(!IsPostBack){
                CustomerLogic CL = new CustomerLogic();
                DataTable dt = CL.SelectAll();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }
            }
        }
        else
        {
            Response.Redirect("Access.aspx");
        }


    }
 protected void Page_Load(object sender, EventArgs e)
 {
     EmployeeLogic el = new EmployeeLogic();
     Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
     if (e2.Designation.Equals("MARKETING MANAGER") || e2.Designation.Equals("MARKETING EMPLOYEE") || e2.Designation.Equals("MANAGING DIRECTOR") || e2.Designation.Equals("CHAIRMAN") || e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE") || e2.Designation.Equals("DESIGNER"))
     {
         if (!IsPostBack)
         {
             CustomerLogic CL = new CustomerLogic();
             Customer c1 = CL.SelectByID(Convert.ToInt32(Request.QueryString["id"]));
             TextBox1.Text = c1.Name;
             TextBox2.Text = c1.Email;
             TextBox3.Text = c1.ContactPerson;
             TextBox8.Text = c1.Phone;
             TextArea1.Text = c1.OfficeAddress;
             TextBox5.Text = c1.DeliveryAddress;
             TextBox6.Text = c1.FactoryAddress;
             TextBox7.Text = c1.GodownAddress;
             TextBox9.Text = c1.OtherAddress;
             TextBox4.Text = c1.HeadOffice;
         }
     }
     else
     {
         Response.Redirect("Access.aspx");
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        CustomerLogic CL = new CustomerLogic();
        Repeater1.DataSource = CL.SelectForReport1();
        Repeater1.DataBind();

        Repeater2.DataSource = CL.SelectForReport1();
        Repeater2.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {   
        EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
       
            if (!IsPostBack)
            {
                if (e2.Designation.Equals("MANAGING DIRECTOR") || e2.Designation.Equals("CHAIRMAN") || e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE") || e2.Designation.Equals("MARKETING MANAGER") || e2.Designation.Equals("MARKETING EMPLOYEE") || e2.Designation.Equals("PRODUCTION MANAGER") || e2.Designation.Equals("PRODUCTION EMPLOYEE"))
                {
                QuotationLogic QL = new QuotationLogic();
                DataTable dt = QL.SelectAllJoined();
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }

                CustomerLogic cl = new CustomerLogic();
                DataTable dt1 = cl.SelectAll();
                dt1.Rows.Add(0, "All Customer", null, null, null, null, null, null, null, null, null);
                dt1.DefaultView.Sort = "CustomerID";
                DropDownList1.DataSource = dt1;
                DropDownList1.DataTextField = "Name";
                DropDownList1.DataValueField = "CustomerID";
                DropDownList1.DataBind();
                DropDownList1.SelectedItem.Text = "All Customer";

                ProductLogic pl = new ProductLogic();
                DataTable dt2 = pl.SelectAll();
                dt2.Rows.Add(0, "All Product", null, null, null, null, null, null, null, null);
                dt2.DefaultView.Sort = "ProductID";
                DropDownList2.DataSource = dt2;
                DropDownList2.DataTextField = "Name";
                DropDownList2.DataValueField = "ProductID";
                DropDownList2.DataBind();
                DropDownList2.SelectedItem.Text = "All Product";
            }
                else
                {
                    Response.Redirect("Access.aspx");
                }
        }
        

    }
コード例 #6
0
        public async Task <ActionResult <CompanyType> > GetAsync(int id)
        {
            if (id <= 0)
            {
                return(BadRequest());
            }

            var companyType = await CustomerLogic.GetCompanyTypeByIdAsync(id);

            if (companyType != null)
            {
                return(Ok(companyType));
            }

            return(NotFound());
        }
コード例 #7
0
        public async Task <ActionResult <Tenant> > GetAsync(string name)
        {
            if (String.IsNullOrWhiteSpace(name))
            {
                return(BadRequest());
            }

            var tenant = await CustomerLogic.GetTenantByNameAsync(name);

            if (tenant != null)
            {
                return(Ok(tenant));
            }

            return(NotFound());
        }
コード例 #8
0
        public async Task <ActionResult <Person> > GetAsync(int id)
        {
            if (id <= 0)
            {
                return(BadRequest());
            }

            var person = await CustomerLogic.GetPersonByIdAsync(id);

            if (person != null)
            {
                return(Ok(person));
            }

            return(NotFound());
        }
コード例 #9
0
        public async Task <ActionResult> DeleteAsync(int id)
        {
            if (id <= 0)
            {
                return(BadRequest());
            }

            if (await CustomerLogic.DeleteCompanyTypeAsync(id))
            {
                return(Ok());
            }

            var errorResult = CheckProblems();

            return((ActionResult)errorResult ?? NotFound());
        }
コード例 #10
0
        public async Task <ActionResult <Tenant> > GetAsync(int id)
        {
            if (id <= 0)
            {
                return(BadRequest());
            }

            var tenant = await CustomerLogic.GetTenantByIdAsync(id);

            if (tenant != null)
            {
                return(Ok(tenant));
            }

            return(NotFound());
        }
コード例 #11
0
        public async Task <ActionResult> CreateAsync([FromBody] PersonInputDto personInput)
        {
            var person = Mapper.Map <Person>(personInput);
            await CustomerLogic.CreatePersonAsync(person);

            var errorResult = CheckProblems();

            if (errorResult != null)
            {
                return(errorResult);
            }

            await PublishEndpoint.Publish <IPersonCreatedEvent>(new { Person = person });

            return(CreatedAtAction(
                       Url.Action(nameof(GetAsync)), new { id = person.Id }, person));
        }
コード例 #12
0
ファイル: Screen.cs プロジェクト: naeemafzal/Responsible
        private void AddButton_Click(object sender, System.EventArgs e)
        {
            var customerToAdd = new Customer
            {
                Firstname = FirstnameTextBox.Text,
                Lastname  = LastnameTextBox.Text
            };

            using (var process = new Processor("Adding Customers"))
            {
                var addResponse = process.Process(() => CustomerLogic.Add(customerToAdd));
                if (addResponse.Success)
                {
                    SearchCustomers();
                }
            }
        }
コード例 #13
0
 public ActionResult Register([ModelBinder(typeof(AddCustomerRole))] CustomerDTO customer)
 {
     try
     {
         if (ModelState.IsValid)
         {
             CustomerLogic.Register(customer);
             return RedirectToAction("Login");
         }
         return View(customer);
     }
     catch (EmailAlreadyExists error)
     {
         ViewBag.ErrorMessage = error.Message;
         return View("Error");
     }
 }
コード例 #14
0
        public async Task <ActionResult> CreateAsync([FromBody] TenantInputDto tenantInput)
        {
            var tenant = Mapper.Map <Tenant>(tenantInput);
            await CustomerLogic.CreateTenantAsync(tenant);

            var errorResult = CheckProblems();

            if (errorResult != null)
            {
                return(errorResult);
            }

            await PublishEndpoint.Publish <ITenantCreatedEvent>(new { Tenant = tenant });

            return(CreatedAtAction(
                       Url.Action(nameof(GetAsync)), new { id = tenant.Id }, tenant));
        }
コード例 #15
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        CustomerLogic cl = new CustomerLogic();
        DataTable     dt = cl.Search(TextBox2.Text);

        Repeater1.DataSource = dt;
        Repeater1.DataBind();
        if (dt.Rows.Count == 0)
        {
            Table1.Visible = false;
            Label1.Visible = true;
        }
        else
        {
            Table1.Visible = true;
            Label1.Visible = false;
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        CustomerLogic cl = new CustomerLogic();
        DataTable dt = cl.Search(TextBox2.Text);

        Repeater1.DataSource = dt;
        Repeater1.DataBind();
        if (dt.Rows.Count == 0)
        {
            Table1.Visible = false;
            Label1.Visible = true;
        }
        else
        {
            Table1.Visible = true;
            Label1.Visible = false;
        }
    }
コード例 #17
0
 public ActionResult list(int type, int pageIndex, int pageSize)
 {
     try
     {
         UserModel user = GetUserData();
         if (user != null)
         {
             var data = CustomerLogic.GetAppCustomerList(user.UserId, user.UserIdentity, type, pageIndex, pageSize);
             return(Json(new ResultModel(ApiStatusCode.OK, data)));
         }
         return(Json(new ResultModel(ApiStatusCode.令牌失效)));
     }
     catch (Exception ex)
     {
         LogHelper.Log(string.Format("list:message:{0},StackTrace:{1}", ex.Message, ex.StackTrace), LogHelperTag.ERROR);
         return(Json(new ResultModel(ApiStatusCode.SERVICEERROR)));
     }
 }
コード例 #18
0
 public ActionResult UpdateInShop(int cid, int status)
 {
     try
     {
         if (CustomerLogic.UpdateInShopStatus(cid, status))
         {
             return(Json(new ResultModel(ApiStatusCode.OK, "保存成功")));
         }
         else
         {
             return(Json(new ResultModel(ApiStatusCode.SERVICEERROR)));
         }
     }
     catch (Exception ex)
     {
         LogHelper.Log(string.Format("UpdateInShop:message:{0},StackTrace:{1}", ex.Message, ex.StackTrace), LogHelperTag.ERROR);
         return(Json(new ResultModel(ApiStatusCode.SERVICEERROR)));
     }
 }
コード例 #19
0
        private static void DisplayCustomerOrderHistory()
        {
            // List all registered customers
            CustomerLogic customerLogic            = new CustomerLogic();
            var           listAllCustomersResponse = customerLogic.GetCustomerList();

            Console.WriteLine(listAllCustomersResponse.Text + "\n");

            // TODO: validate if user exists
            // Prompt user to select customer
            Console.WriteLine("From the list above please enter the name of the customer whose order history you wish to view");
            string usernameInput = Console.ReadLine();

            // Show results

            OrderLogic orderLogic = new OrderLogic();

            Console.WriteLine(orderLogic.FindOrdersByCustomerNamePacket(usernameInput).Text);
        }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if((Convert.ToInt32(Request.QueryString["id"])>0))
        {

            CustomerLogic CL = new CustomerLogic();
            Customer c1 = new Customer();
            c1.Name = TextBox1.Text;
            c1.Email = TextBox2.Text;
            c1.Phone = TextBox8.Text;
            c1.ContactPerson = TextBox3.Text;
            c1.OfficeAddress = TextArea1.Text;
            c1.DeliveryAddress = TextBox5.Text;
            c1.HeadOffice = TextBox4.Text;
            c1.FactoryAddress = TextBox6.Text;
            c1.GodownAddress = TextBox7.Text;
            c1.OtherAddress = TextBox9.Text;
            c1.CustomerID = Convert.ToInt32(Request.QueryString["id"]);
            CL.Update(c1);
            Response.Redirect("CustomerList.aspx");
        
        }
        else
        {
            Customer c1 = new Customer();
            c1.Name = TextBox1.Text;
            c1.Email = TextBox2.Text;
            c1.Phone = TextBox8.Text;
            c1.ContactPerson = TextBox3.Text;
            c1.OfficeAddress = TextArea1.Text;
            c1.DeliveryAddress = TextBox5.Text;
            c1.HeadOffice = TextBox4.Text;
            c1.FactoryAddress = TextBox6.Text;
            c1.GodownAddress = TextBox7.Text;
            c1.OtherAddress = TextBox9.Text;

            CustomerLogic CL = new CustomerLogic();
            CL.Insert(c1);

            Response.Redirect("CustomerList.aspx");
        }
      
    }
 protected void LinkButton1_Command(object sender, CommandEventArgs e)
 {
     EmployeeLogic el = new EmployeeLogic();
     Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
     if (e2.Designation.Equals("MARKETING MANAGER") || e2.Designation.Equals("MARKETING EMPLOYEE") || e2.Designation.Equals("MANAGING DIRECTOR") || e2.Designation.Equals("CHAIRMAN") || e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE") || e2.Designation.Equals("DESIGNER"))
     {
         CustomerLogic cl = new CustomerLogic();
         Customer c1 = cl.SelectByID(Convert.ToInt32(e.CommandArgument));
         if (c1 != null)
         {
             int i = cl.Delete(c1.CustomerID);
             Response.Redirect("CustomerList.aspx");
         }
     }
     else
     {
         Response.Redirect("Access.aspx");
     }
 }
コード例 #22
0
        public IActionResult CustomerDetail(int id)
        {
            SetViewData();
            if (!UserAllowed())
            {
                ViewData["Warning"] = "Neautorizovaný přístup.";
                return(View("Warning"));
            }

            if (CustomerLogic.GetCustomer(id) is DataLayerNetCore.Entities.Customer c)
            {
                return(View(c));
            }
            else
            {
                ViewData["Warning"] = "Neexistující zákazník.";
                return(View("Warning"));
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
         EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
       
            if (!IsPostBack)
            {
                if (!(e2.Designation.Equals("STOCK MANAGER") || e2.Designation.Equals("STOCK EMPLOYEE") || e2.Designation.Equals("ACCOUNTATANT") || e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE")))
                {
                ProductLogic PL = new ProductLogic();

                DataTable dt = PL.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }

                CustomerLogic cl = new CustomerLogic();
                DataTable dt1 = cl.SelectAll();
                dt1.Rows.Add(0, "All Customers", null, null, null, null, null, null, null, null, null);
                dt1.DefaultView.Sort = "CustomerID";
                DropDownList2.DataSource = dt1;
                DropDownList2.DataTextField = "Name";
                DropDownList2.DataValueField = "CustomerID";
                DropDownList2.DataBind();
                //DropDownList2.SelectedValue = "All Customers";
            }
                else
                {
                    Response.Redirect("Access.aspx");
                }
        }
       
    }
コード例 #24
0
        /// <summary>
        /// 编辑客户信息
        /// </summary>
        private void EditCustomerInfo()
        {
            CustomerModel model = new CustomerModel()
            {
                ID     = GetFormValue("customerid", 0),
                Name   = GetFormValue("username", ""),
                Mobile = GetFormValue("usermobile", ""),
                Addr   = GetFormValue("useraddress", "")
            };

            if (CustomerLogic.UpdateCustomerInfo(model))
            {
                json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.OK));
            }
            else
            {
                json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.更新失败));
            }
        }
コード例 #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        EmployeeLogic el = new EmployeeLogic();
        Employee      e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));

        if (!IsPostBack)
        {
            if (!(e2.Designation.Equals("STOCK MANAGER") || e2.Designation.Equals("STOCK EMPLOYEE") || e2.Designation.Equals("ACCOUNTATANT") || e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE")))
            {
                ProductLogic PL = new ProductLogic();

                DataTable dt = PL.SelectAllJoined();

                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }

                CustomerLogic cl  = new CustomerLogic();
                DataTable     dt1 = cl.SelectAll();
                dt1.Rows.Add(0, "All Customers", null, null, null, null, null, null, null, null, null);
                dt1.DefaultView.Sort         = "CustomerID";
                DropDownList2.DataSource     = dt1;
                DropDownList2.DataTextField  = "Name";
                DropDownList2.DataValueField = "CustomerID";
                DropDownList2.DataBind();
                //DropDownList2.SelectedValue = "All Customers";
            }
            else
            {
                Response.Redirect("Access.aspx");
            }
        }
    }
コード例 #26
0
        public void Test_LoginCheck()
        {
            var options = new DbContextOptionsBuilder <CustomerContext>()
                          .UseInMemoryDatabase(databaseName: "TestDb26")
                          .Options;

            using (var context = new CustomerContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                CustomerRepository custRepo = new CustomerRepository(context);
                CustomerLogic      cl       = new CustomerLogic(custRepo);

                string   password    = "******";
                Customer newCustomer = new Customer();
                using (var hmac = new HMACSHA512())
                {
                    newCustomer.Fname       = "Testing";
                    newCustomer.Lname       = "Test";
                    newCustomer.Email       = "*****@*****.**".ToLower();
                    newCustomer.LastStore   = Guid.Empty;
                    newCustomer.StoreManger = Guid.Empty;

                    newCustomer.PasswordHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(password));
                    newCustomer.PasswordSalt = hmac.Key;
                }

                context.Add <Customer>(newCustomer);
                context.SaveChanges();

                RawCustomer rCust = new RawCustomer();
                rCust.Email    = "*****@*****.**";
                rCust.Fname    = "Testing";
                rCust.Lname    = "Test";
                rCust.Password = password;

                Customer newCust = cl.LoginCheck(rCust);

                Assert.Equal(newCustomer.Email, newCust.Email);
            }
        }
コード例 #27
0
    protected void LinkButton1_Command(object sender, CommandEventArgs e)
    {
        EmployeeLogic el = new EmployeeLogic();
        Employee      e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));

        if (e2.Designation.Equals("MARKETING MANAGER") || e2.Designation.Equals("MARKETING EMPLOYEE") || e2.Designation.Equals("MANAGING DIRECTOR") || e2.Designation.Equals("CHAIRMAN") || e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE") || e2.Designation.Equals("DESIGNER"))
        {
            CustomerLogic cl = new CustomerLogic();
            Customer      c1 = cl.SelectByID(Convert.ToInt32(e.CommandArgument));
            if (c1 != null)
            {
                int i = cl.Delete(c1.CustomerID);
                Response.Redirect("CustomerList.aspx");
            }
        }
        else
        {
            Response.Redirect("Access.aspx");
        }
    }
コード例 #28
0
 private void DeleteBtn_Click(object sender, EventArgs e)
 {
     if (customerGridView.CurrentRow.DataBoundItem is Customer selectedCustomer)
     {
         if (MessageBox.Show("Opravdu chcete smazat zakaznika " +
                             selectedCustomer.Surename + " " + selectedCustomer.Name + " ?",
                             "Otazka", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             if (CustomerLogic.CanBeDeleted(selectedCustomer.Id))
             {
                 CustomerLogic.DeleteCustomer(selectedCustomer);
                 Reload();
             }
             else
             {
                 MessageBox.Show("Zákazník nemohl být smazát protože se k němu vážou záznamy.", "Upozornění", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
 }
コード例 #29
0
        public IActionResult Registration(RegistrationForm model)
        {
            ShowLoggedUser();

            model.GoodPersonalNumber = CustomerLogic.GoodPersonalNumber(model.PersonalNumber);
            model.LoginAvaible       = UserLogic.LoginAvaible(model.Login);


            if (ModelState.IsValid && model.LoginAvaible && model.GoodPersonalNumber)
            {
                try
                {
                    CustomerLogic.CreateCustomer(new Customer
                    {
                        Login          = model.Login,
                        Password       = model.Password,
                        Name           = model.Name,
                        Surename       = model.Surename,
                        PersonalNumber = model.PersonalNumber,
                        City           = new City
                        {
                            Name    = model.CityName,
                            ZipCode = model.CityZip
                        },
                        Street      = model.Street,
                        HouseNumber = model.HouseNumber,
                        Phone       = model.Phone,
                        Email       = model.Email
                    });
                }
                catch (DatabaseException e)
                {
                    return(View("Error", new ErrorViewModel {
                        RequestId = e.Message
                    }));
                }

                return(RedirectToAction("RegistrationCompleted", "Home", new { result = "OK" }));
            }
            return(View(model));
        }
コード例 #30
0
ファイル: ajax.asmx.cs プロジェクト: casualbill/DCSMS
        //城市列表
        public String cityList(int provinceId)
        {
            CustomerLogic customerLogic = new CustomerLogic();

            DataTable dt  = customerLogic.cityListQuery(provinceId);
            String    str = "[";

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    str += "{";
                    str += "\"id\":" + dr["Id"] + ",";
                    str += "\"city\":\"" + dr["City"] + "\"";
                    str += "},";
                }
                str = str.Substring(0, str.Length - 1);
            }
            str += "]";
            return(str);
        }
コード例 #31
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var cl      = new CustomerLogic();
            var couties = cl.LoadCountries();

            foreach (var coutry in couties.Solution)
            {
                Debug.WriteLine(coutry);
                Trace.Write(coutry);
            }

            try
            {
                cl.InsertCustomer("ALFKI", new Customer());
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                Trace.Warn(ex.Message.ToString());
            }
        }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if ((Convert.ToInt32(Request.QueryString["id"]) > 0))
        {
            CustomerLogic CL = new CustomerLogic();
            Customer      c1 = new Customer();
            c1.Name            = TextBox1.Text;
            c1.Email           = TextBox2.Text;
            c1.Phone           = TextBox8.Text;
            c1.ContactPerson   = TextBox3.Text;
            c1.OfficeAddress   = TextArea1.Text;
            c1.DeliveryAddress = TextBox5.Text;
            c1.HeadOffice      = TextBox4.Text;
            c1.FactoryAddress  = TextBox6.Text;
            c1.GodownAddress   = TextBox7.Text;
            c1.OtherAddress    = TextBox9.Text;
            c1.CustomerID      = Convert.ToInt32(Request.QueryString["id"]);
            CL.Update(c1);
            Response.Redirect("CustomerList.aspx");
        }
        else
        {
            Customer c1 = new Customer();
            c1.Name            = TextBox1.Text;
            c1.Email           = TextBox2.Text;
            c1.Phone           = TextBox8.Text;
            c1.ContactPerson   = TextBox3.Text;
            c1.OfficeAddress   = TextArea1.Text;
            c1.DeliveryAddress = TextBox5.Text;
            c1.HeadOffice      = TextBox4.Text;
            c1.FactoryAddress  = TextBox6.Text;
            c1.GodownAddress   = TextBox7.Text;
            c1.OtherAddress    = TextBox9.Text;

            CustomerLogic CL = new CustomerLogic();
            CL.Insert(c1);

            Response.Redirect("CustomerList.aspx");
        }
    }
コード例 #33
0
        public void Fetch_Customers_Works()
        {
            DbContextOptions <P1_DbContext> options = new DbContextOptionsBuilder <P1_DbContext>()
                                                      .UseInMemoryDatabase(databaseName: "Add_Writes_To_Db").Options;

            using (P1_DbContext context = new P1_DbContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
                P1_Repo repo = new P1_Repo(context);
                repo.Register("AAA", "BBB", "CCC", "098890098890");
                repo.Register("AAA", "BBB", "CCC", "098778900987");
                context.SaveChanges();
            }

            using (P1_DbContext context = new P1_DbContext(options))
            {
                P1_Repo       repo  = new P1_Repo(context);
                CustomerLogic logic = new CustomerLogic(repo, new HttpContextAccessor());
                Assert.AreEqual(2, logic.FetchCustomers().Count());
            }
        }
コード例 #34
0
        public async Task GetAllCustomers_ReturningAllCustomers_AllCustomersReturned()
        {
            var data = new List <Customer>
            {
                new Customer {
                    name = "BBB"
                },
                new Customer {
                    name = "ZZZ"
                },
                new Customer {
                    name = "AAA"
                }
            }.AsQueryable();
            var mockSet = new Mock <DbSet <Customer> >();

            mockSet.As <IDbAsyncEnumerable <Customer> >()
            .Setup(m => m.GetAsyncEnumerator())
            .Returns(new TestDbAsyncEnumerator <Customer>(data.GetEnumerator()));
            mockSet.As <IQueryable <Customer> >()
            .Setup(m => m.Provider)
            .Returns(new TestDbAsyncQueryProvider <Customer>(data.Provider));
            mockSet.As <IQueryable <Customer> >().Setup(m => m.Expression).Returns(data.Expression);
            mockSet.As <IQueryable <Customer> >().Setup(m => m.ElementType).Returns(data.ElementType);
            mockSet.As <IQueryable <Customer> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());
            var mockContext = new Mock <ExtremeSportDBEntities>();

            mockContext.Setup(c => c.Customer).Returns(mockSet.Object);
            var customerLogic = new CustomerLogic {
                Context = mockContext.Object
            };
            var cust = await customerLogic.GetCustomers();

            Assert.AreEqual(3, cust.Count);
            Assert.AreEqual("BBB", cust[0].Name);
            Assert.AreEqual("ZZZ", cust[1].Name);
            Assert.AreEqual("AAA", cust[2].Name);
        }
コード例 #35
0
        public ActionResult Remind()
        {
            try
            {
                var user = GetUserData();

                Dictionary <string, object> data = new Dictionary <string, object>();

                //我的留言未读数量
                data["messageCount"] = ArticleLogic.GetNotReadMessageCount(user.UserId, 2);
                //我的消息-发送消息未读数量
                data["messagePushCount"] = ArticleLogic.GetNotReadMessageCount(user.UserId, 0);
                //我的消息-接收消息未读数量
                data["messagePullCount"] = ArticleLogic.GetNotReadMessageCount(user.UserId, 1);

                bool isbusiness = false;
                if (user.UserIdentity == 1)
                {
                    //客户数量
                    int customerAmount = CustomerLogic.GetCustomerCount(user.UserId, user.UserIdentity, 0);
                    //兑换数量
                    int exchangeAmount = UserLogic.GetConvertCount(user.UserId, 0);

                    int allyApplyAmount = UserLogic.AllyApplyCount(user.UserId);
                    if (customerAmount > 0 || exchangeAmount > 0 || allyApplyAmount > 0)
                    {
                        isbusiness = true;
                    }
                }
                data["businessRemind"] = isbusiness;
                return(Json(new ResultModel(ApiStatusCode.OK, data)));
            }
            catch (Exception ex)
            {
                LogHelper.Log(string.Format("Remind user:message:{0},StackTrace:{1}", ex.Message, ex.StackTrace), LogHelperTag.ERROR);
                return(Json(new ResultModel(ApiStatusCode.SERVICEERROR)));
            }
        }
コード例 #36
0
        /// <summary>
        /// Save data
        /// </summary>
        /// <param name="model">Model</param>
        /// <returns>Save data view</returns>
        public async Task <ActionResult> SaveData(EditDataViewModel model)
        {
            DtoCustomer customer = new DtoCustomer()
            {
                Id                     = model.Id,
                Name                   = model.Name,
                Surname                = model.Surname,
                Street                 = model.Street,
                City                   = model.City,
                PostalCode             = model.PostalCode,
                PhoneNumber            = model.PhoneNumber,
                IcePhoneNumber         = model.IcePhoneNumber,
                Email                  = model.Email,
                IdentityCardNumber     = model.IdentityCardNumber,
                PersonalIdentityNumber = model.PersonalIdentityNumber,
                ApartmentNumber        = model.ApartmentNumber,
                HouseNumber            = model.HouseNumber,
                Password               = model.Password
            };
            CustomerLogic logic = new CustomerLogic();
            bool          isRegistrationSuccessful = await logic.SaveCustomer(customer);

            string errorText = null;

            if (isRegistrationSuccessful)
            {
                FormsAuthentication.RedirectFromLoginPage(model.Email, true);
            }
            else
            {
                errorText = "Błąd podczas zapisywania danych";
            }

            return(View("EditData", new EditDataViewModel()
            {
                ErrorText = errorText
            }));
        }
コード例 #37
0
        public ActionResult Edit(Guid? id)
        {
            CustomerDTO customer = new CustomerDTO();            
            try
            {
                if (id == null)
                {
                    return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                }
                customer = CustomerLogic.FindId(id);
                if (customer == null)
                {
                    return HttpNotFound();
                }
            }
            catch
            {
                return View(customer);
            }
            
            return View(customer);

        }
コード例 #38
0
        public ActionResult Login([Bind(Include = "Id,Email,Password")] CustomerDTO user)
        {
            try
            {
                if (ModelState.IsValid)
                {

                    CustomerDTO foundCustomer = CustomerLogic.Find(user);
                    if (foundCustomer != null)
                    {
                        Session["UserName"] = foundCustomer.Name;
                        Session["Email"] = foundCustomer.Email;
                        Session["Role"] = (foundCustomer.Role == 1 ? "Admin" : "Normal Customer");
                        Session["Id"] = foundCustomer.Id;
                        Session["Address1"] = foundCustomer.Address1;
                        Session["Address2"] = foundCustomer.Address2;
                        Session["Address3"] = foundCustomer.Address3;

                    }

                    return RedirectToAction("Details");
                }
                return View(user);
            }
            catch (RetryLimitExceededException /* dex */)
            {
                //Log the error (uncomment dex variable name and add a line here to write a log.
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
                return View("Error");
            }
            catch (Exception)
            {
                return View("Error");
            }

        }
コード例 #39
0
        public async Task SaveCustomer_AddingValidCustomer_CustomerAdded()
        {
            var data    = new List <Customer>().AsQueryable();
            var mockSet = new Mock <DbSet <Customer> >();

            mockSet.As <IDbAsyncEnumerable <Customer> >()
            .Setup(m => m.GetAsyncEnumerator())
            .Returns(new TestDbAsyncEnumerator <Customer>(data.GetEnumerator()));
            mockSet.As <IQueryable <Customer> >()
            .Setup(m => m.Provider)
            .Returns(new TestDbAsyncQueryProvider <Customer>(data.Provider));
            mockSet.As <IQueryable <Customer> >().Setup(m => m.Expression).Returns(data.Expression);
            var mockContext = new Mock <ExtremeSportDBEntities>();

            mockContext.Setup(m => m.Customer).Returns(mockSet.Object);
            var customerLogic = new CustomerLogic {
                Context = mockContext.Object
            };
            var b = await customerLogic.SaveCustomer(new DtoCustomer());

            Assert.AreEqual(b, true);
            mockSet.Verify(m => m.Add(It.IsAny <Customer>()), Times.Once());
            mockContext.Verify(m => m.SaveChangesAsync(), Times.Once());
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
       
            if (!IsPostBack)
            {
                if (!(e2.Designation.Equals("STOCK MANAGER") || e2.Designation.Equals("STOCK EMPLOYEE") || e2.Designation.Equals("ACCOUNTATANT") || e2.Designation.Equals("EMPLOYEE") || e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE")))
                {

                CustomerLogic sl = new CustomerLogic();
                DropDownList2.DataSource = sl.SelectAll();
                DropDownList2.DataTextField = "Name";
                DropDownList2.DataValueField = "CustomerID";
                DropDownList2.DataBind();
                if (Convert.ToInt32(Request.QueryString["id"]) > 0)
                {
                    // edit mode

                    ProductLogic pl = new ProductLogic();
                    Product p1 = pl.SelectByProductID(Convert.ToInt32(Request.QueryString["id"]));
                    TextBox1.Text = p1.Name;
                    TextBox2.Text = p1.CreateDate.ToString("dd/MM/yyyy");
                   DropDownList3.SelectedItem.Text = p1.Status;
                    TextArea1.Text = p1.Description;
                    TextBox4.Text = p1.Size;
                    TextBox5.Text = p1.Colors;

                    String images = p1.DesignFiles;
                    String[] arr = images.Split(new String[] { "#,#" }, StringSplitOptions.RemoveEmptyEntries);
                    if (arr.Length > 0)
                    {
                        FileUpload1.Visible = false;
                        lnkImage1.Text = arr[0].Substring(25);
                        lnkImage1.NavigateUrl = arr[0];
                    }
                    else
                    {
                        lnkImage1.Visible = false;
                        LinkButton1.Visible = false;
                    }
                    if (arr.Length > 1)
                    {
                        lnkImage2.Text = arr[1].Substring(25);
                        lnkImage2.NavigateUrl = arr[1];
                    }
                    else
                    {
                        lnkImage2.Visible = false;
                        LinkButton2.Visible = false;
                    }
                    if (arr.Length > 2)
                    {
                        lnkImage3.Text = arr[2].Substring(25);
                        lnkImage3.NavigateUrl = arr[2];
                    }
                    else
                    {
                        lnkImage3.Visible = false;
                        LinkButton3.Visible = false;
                    }
                    if (arr.Length > 3)
                    {
                        lnkImage4.Text = arr[3].Substring(25);
                        lnkImage4.NavigateUrl = arr[3];
                    }
                    else
                    {
                        lnkImage4.Visible = false;
                        LinkButton4.Visible = false;
                    }
                    if (arr.Length > 4)
                    {
                        lnkImage5.Text = arr[4].Substring(25);
                        lnkImage5.NavigateUrl = arr[4];
                    }
                    else
                    {
                        lnkImage5.Visible = false;
                        LinkButton5.Visible = false;
                    }

                    DropDownList1.SelectedItem.Text = p1.Type;


                    Customer s = sl.SelectByID(p1.CustomerID);
                    DropDownList2.SelectedItem.Text = s.Name;
                }
                else
                {
                    lnkImage1.Visible = false;
                    lnkImage2.Visible = false;
                    lnkImage3.Visible = false;
                    lnkImage4.Visible = false;
                    lnkImage5.Visible = false;
                    LinkButton1.Visible = false;
                    LinkButton2.Visible = false;
                    LinkButton3.Visible = false;
                    LinkButton4.Visible = false;
                    LinkButton5.Visible = false;
                    TextBox2.Text = DateTime.Now.ToString("dd/MM/yyyy");
                }
            }
                else
                {
                    Response.Redirect("Access.aspx");
                }
        }
       
    }
コード例 #41
0
ファイル: ApiModule.cs プロジェクト: duhaly/NancyFxApi
        public ApiModule()
            : base("/api")
        {
            #region  ///  Help Page  ///
            Get["/help"] = x => View["help"];
            #endregion

            #region  ///  Category  ///

            #region  ///  /api/Categories/  ///
            Get["/categories"] = x =>
            {
                var logic = new CategoryLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Categories/1234  ///
            Get["/categories/{id:int}"] = x =>
            {
                var logic = new CategoryLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Customer  ///

            #region  ///  /api/Customers/  ///
            Get["/customers"] = x =>
            {
                var logic = new CustomerLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Customers/1234  ///
            Get["/customers/{id*}"] = x =>
            {
                var logic = new CustomerLogic();

                var result = logic.GetById((string)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Employee  ///

            #region  ///  /api/employees  ///
            Get["/employees"] = x =>
            {
                var logic = new EmployeeLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  ///  /api/employees/1234  ///
            Get["/employees/{id:int}"] = x =>
            {
                var logic = new EmployeeLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Order  ///

            #region  ///  /api/Orders/  ///
            Get["/orders"] = x =>
            {
                var logic = new OrderLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Orders/1234  ///
            Get["/orders/{id:int}"] = x =>
            {
                var logic = new OrderLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Product  ///

            #region  ///  /api/Products/  ///
            Get["/products"] = x =>
            {
                var logic = new ProductLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Products/1234  ///
            Get["/products/{id:int}"] = x =>
            {
                var logic = new ProductLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Region  ///

            #region  ///  /api/Regions/  ///
            Get["/regions"] = x =>
            {
                var logic = new RegionLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Regions/1234  ///
            Get["/regions/{id:int}"] = x =>
            {
                var logic = new RegionLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Shipper  ///

            #region  ///  /api/Shippers/  ///
            Get["/shippers"] = x =>
            {
                var logic = new ShipperLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Shippers/1234  ///
            Get["/shippers/{id:int}"] = x =>
            {
                var logic = new ShipperLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Supplier  ///

            #region  ///  /api/Suppliers/  ///
            Get["/suppliers"] = x =>
            {
                var logic = new SupplierLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Suppliers/1234  ///
            Get["/suppliers/{id:int}"] = x =>
            {
                var logic = new SupplierLogic();

                var result = logic.GetById((int)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion

            #region  ///  Territory  ///

            #region  ///  /api/Territories/  ///
            Get["/territories"] = x =>
            {
                var logic = new TerritoryLogic();

                var result = logic.GetAll();

                return Response.AsJson(result);
            };
            #endregion

            #region  /// /api/Territories/1234  ///
            Get["/territories/{id:string}"] = x =>
            {
                var logic = new TerritoryLogic();

                var result = logic.GetById((string)x.id);

                return Response.AsJson(result);
            };
            #endregion

            #endregion
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
        if (!IsPostBack)
        {
            if (!(e2.Designation.Equals("STOCK MANAGER") || e2.Designation.Equals("STOCK EMPLOYEE") || e2.Designation.Equals("ACCOUNTATANT") || e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE")))
            {
                ProductLogic pl = new ProductLogic();
                Product p1 = pl.SelectByProductID(Convert.ToInt32(Request.QueryString["id"])); ;

                if (p1 != null)
                {
                    Label1.Text = p1.Name;
                    Label2.Text = p1.CreateDate.ToString("dd/MM/yyyy");

                    String st = p1.DesignFiles;
                    String[] arr = st.Split(new String[] { "#,#" }, StringSplitOptions.RemoveEmptyEntries);
                    if (arr.Length > 0)
                    {
                        lnkImage1.Text = arr[0].Substring(25);
                        lnkImage1.NavigateUrl = arr[0];
                    }
                    else
                    {
                        lnkImage1.Visible = false;
                    }

                    if (arr.Length > 1)
                    {
                        lnkImage2.Text = arr[1].Substring(25);
                        lnkImage2.NavigateUrl = arr[1];
                    }
                    else
                    {
                        lnkImage2.Visible = false;
                    }
                    if (arr.Length > 2)
                    {
                        lnkImage3.Text = arr[2].Substring(25);
                        lnkImage3.NavigateUrl = arr[2];
                    }
                    else
                    {
                        lnkImage3.Visible = false;
                    }
                    if (arr.Length > 3)
                    {
                        lnkImage4.Text = arr[3].Substring(25);
                        lnkImage4.NavigateUrl = arr[3];
                    }
                    else
                    {
                        lnkImage4.Visible = false;
                    }
                    if (arr.Length > 4)
                    {
                        lnkImage5.Text = arr[4].Substring(25);
                        lnkImage5.NavigateUrl = arr[4];
                    }
                    else
                    {
                        lnkImage5.Visible = false;
                    }
                    Label4.Text = p1.Status;
                    Label5.Text = p1.Description;
                    Label6.Text = p1.Size;
                    Label7.Text = p1.Colors;
                    Label8.Text = p1.Type;

                    CustomerLogic cl = new CustomerLogic();
                    Customer c1 = cl.SelectByID(p1.CustomerID);
                    Label9.Text = c1.Name;

                }
            }
            else
            {
                Response.Redirect("Access.aspx");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt = new AttendanceLogic().SelectForAttendanceReport(DateTime.Today);

        int present = Convert.ToInt32(dt.Rows[0][1]);
        int absent = Convert.ToInt32(dt.Rows[1][1]);


        lblPResentPerc.Text = ((float)present * 100) / ((float)present + absent) + "";
        lblPResentPerc.Attributes.Add("Present", present.ToString());
        lblPResentPerc.Attributes.Add("Absent", absent.ToString());

        DataTable dt1 = new InvoiceLogic().SelectForBestOrder();

        bestOrd.Text = dt1.Rows[0]["ProductName"].ToString();
        totalAmt.Text = dt1.Rows[0]["GrandTotal"].ToString();
        txtCustomer.Text = dt1.Rows[0]["CustomerName"].ToString();
        string dp = dt1.Rows[0]["ProductImage"].ToString();
        String[] arr = dp.Split(new String[] { "#,#" }, StringSplitOptions.RemoveEmptyEntries);
        proimg.Src = arr[arr.Length - 1];

        DataTable dt2 = new InvoiceLogic().SelectForRevenue();
        txtTotIncome.Text = dt2.Rows[0]["TotalIncome"].ToString();

        DataTable dt4 = new InvoiceLogic().SelectIndividualInvoiceAmount();
        string s = "";
        for (int i = 0; i < dt4.Rows.Count; i++)
        {
            s += dt4.Rows[i]["GrandTotal"] + ",";
        }
        s = "[" + s.TrimEnd(',') + "]";
        individualInvoiceAmount.Attributes.Add("data-data", s);


        DataTable dt3 = new ProductLogic().SelectBestProduct();
        OrderNumber.Text = dt3.Rows[0]["Total"].ToString() + " Orders";
        string dp1 = dt3.Rows[0]["DesignFiles"].ToString();
        String[] arr1 = dp1.Split(new String[] { "#,#" }, StringSplitOptions.RemoveEmptyEntries);
        topProimg.Src = arr1[arr1.Length - 1];

        ProName.Text = dt3.Rows[0]["Name"].ToString();
        
        DataTable dt5 = new InvoiceLogic().SelectTotalSale2();
        Repeater2.DataSource = dt5;
        Repeater2.DataBind();
        DataTable dt6 = new InventoryLogic().SelectRawStock();
        Repeater1.DataSource = dt6;
        Repeater1.DataBind();

        CustomerLogic CL = new CustomerLogic();
        Repeater3.DataSource = CL.SelectForReport1();
        Repeater3.DataBind();
        TransitionLogic ol = new TransitionLogic();
        Repeater9.DataSource = ol.SelectProductStatus1(DateTime.Today);
        Repeater9.DataBind();

        TransitionLogic ol2 = new TransitionLogic();
        Repeater4.DataSource = ol2.SelectOrderStatus1(DateTime.Today);
        Repeater4.DataBind();

    }