public static bool Register(Customer c) { if (CustomerDAL.AddCustomer(c)) { return(true); } return(false); }
static void Main(string[] args) { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); ConfigurationData config = GetConfigurationDetails(); // Uncomment following to get Customer records CustomerDAL.AddCustomer(config); ProductDAL.AddProduct(config); //CoverKingDAL.SaveBaseVehicleAppData(config.ConnectionString); //CoverKingDAL.SaveItemVariantImages(config.ConnectionString); CsvFilebase baseCSBV = new CsvFilebase(); string filePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); string coverkingPath = Path.Combine(filePath, "../../CoverKingData/"); /* * DirectoryInfo dirApp = new DirectoryInfo(Path.Combine(coverkingPath, "AppData/Incoming/")); * foreach (var file in dirApp.GetFiles()) * { * var aData = baseCSBV.Read<DownloadVariant>(file.FullName, true); * CoverKingDAL.Save(config.ConnectionString, aData); * file.MoveTo(Path.Combine(coverkingPath, "AppData/Processed/" + file.Name)); * } */ DirectoryInfo dirJobber = new DirectoryInfo(Path.Combine(coverkingPath, "Jobber/Incoming/")); foreach (var file in dirJobber.GetFiles()) { var jData = baseCSBV.Read <DownloadedItem>(file.FullName, true, new Dictionary <string, string>() { { "ItemOrSKU", "Item/SKU" }, { "UPC_Code", "UPC Code" }, { "Gross_Weight", "Gross Weight" }, { "Product_Family_ID", "ProductFamily ID" }, { "Product_Family_Description", "Product Family Description" }, }); CoverKingDAL.Save(config.ConnectionString, jData); file.MoveTo(Path.Combine(coverkingPath, "Jobber/Processed/" + file.Name)); } DirectoryInfo dirAmazon = new DirectoryInfo(Path.Combine(coverkingPath, "AmazonVariant/Incoming/")); foreach (var file in dirAmazon.GetFiles()) { var amazonVariantData = baseCSBV.Read <AmazonVariant>(file.FullName, true, new Dictionary <string, string>() { { "SKUOrUPC", "SKU/UPC" }, }); CoverKingDAL.Save(config.ConnectionString, amazonVariantData); file.MoveTo(Path.Combine(coverkingPath, "Jobber/Processed/" + file.Name)); } CoverKingDAL.SaveProductOnJobber(config.ConnectionString); //OrderDAL.PlaceOrder(config, true, true, true); }
public IActionResult AddCustomer(string customername, string country, DateTime creationDate) { Customer c = new Customer(customername, country, creationDate); CustomerDAL customerDAL = new CustomerDAL(); customerDAL.AddCustomer(c); return(RedirectToAction("Index")); }
public void AddCustomerTest(string name, string address) { Customer c = new Customer { CustomerName = name, CustomerAddress = address }; int?result = customerDal.AddCustomer(c); Assert.NotNull(result); Assert.True((result ?? 0) > 0); }
public void Save() { if (string.IsNullOrWhiteSpace(txtContactName.Text) || (string.IsNullOrWhiteSpace(txtQQ.Text) && string.IsNullOrWhiteSpace(txtEmail.Text) && string.IsNullOrWhiteSpace(txtPhone1.Text) && string.IsNullOrWhiteSpace(txtPhone2.Text))) { return; } CustomerDAL dal = new CustomerDAL(); var customers = dal.GetAllCustomer(); var customer = from c in customers where ( c.ContactName == ContactName ) && (c.Email == Email || string.IsNullOrEmpty(Email) ) && (c.QQ == QQ || string.IsNullOrEmpty(QQ) ) && (c.Phone1 == Phone1 || string.IsNullOrEmpty(Phone1) ) && (c.Phone2 == Phone2 || string.IsNullOrEmpty(Phone2) ) select c; if (customer != null && customer.Count() > 0) { return; } Customer cust = new Customer() { Address = Address, ContactName = ContactName, CustomerCompanyName = CompanyName, CustomerOthers = Other, Email = Email, Phone1 = Phone1, Phone2 = Phone2, QQ = QQ }; dal.AddCustomer(cust); dal.Save(); }
/// <summary> /// Adding cutomer /// </summary> /// <param name="customers"></param> public void AddCustomer(Customer customer) { //Validating customer name if (customer.CustomerName != null && customer.CustomerPhoneNumber != null) { cdal.AddCustomer(customer); } else { throw new Exception("Name can't be null,Please Mention your name"); } }
public string Add(string Name, string EmailId, string password, string gender, DateTime DOB, string Address) { string result = ""; try { CustomerDAL customerObj = new CustomerDAL(); result = customerObj.AddCustomer(Name, EmailId, password, gender, DOB, Address); } catch (Exception) { result = "Failed"; } return(result); }
public int AddCustomer(Customer customer) { return cdal.AddCustomer(customer) ?? 0; }
public int AddCustomer(CustomerEntities ce) { return(cd.AddCustomer(ce)); }
public bool AddCustomer(Customer customer) { return(db.AddCustomer(customer)); }
/// <summary> /// 增加一条数据 /// </summary> public int AddCustomer(CustomerModel model) { return(_dal.AddCustomer(model)); }
public bool AddCustomer(Customer e) { return(customerDAL.AddCustomer(e)); }
public ResponseModel AddCustomer(Customer model) { return(_dal.AddCustomer(model)); }
public bool Addcustomer(CustomerDTO customerDto) { return(data.AddCustomer(customerDto)); }
protected void rpCustomer_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Add") { if (e.Item.ItemType == ListItemType.Header) { TextBox txtCustomerCompanyNameAdd = e.Item.FindControl("txtCustomerCompanyNameAdd") as TextBox; TextBox txtContactNameAdd = e.Item.FindControl("txtContactNameAdd") as TextBox; TextBox txtAddressAdd = e.Item.FindControl("txtAddressAdd") as TextBox; TextBox txtEmailAdd = e.Item.FindControl("txtEmailAdd") as TextBox; TextBox txtPhone1Add = e.Item.FindControl("txtPhone1Add") as TextBox; TextBox txtPhone2Add = e.Item.FindControl("txtPhone2Add") as TextBox; TextBox txtQQAdd = e.Item.FindControl("txtQQAdd") as TextBox; TextBox txtOthersAdd = e.Item.FindControl("txtOthersAdd") as TextBox; CustomerDAL dal = new CustomerDAL(); Customer customer = new Customer() { CustomerCompanyName = txtCustomerCompanyNameAdd.Text, ContactName = txtContactNameAdd.Text, Address = txtAddressAdd.Text, Email = txtEmailAdd.Text, Phone1 = txtPhone1Add.Text, Phone2 = txtPhone2Add.Text, QQ = txtQQAdd.Text, CustomerOthers = txtOthersAdd.Text }; dal.AddCustomer(customer); dal.Save(); } } if (e.CommandName == "Delete") { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { HiddenField hfId = e.Item.FindControl("hfId") as HiddenField; CustomerDAL dal = new CustomerDAL(); dal.DeleteCustomer(int.Parse(hfId.Value)); } } if (e.CommandName == "Save") { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { TextBox txtCustomerCompanyName = e.Item.FindControl("txtCustomerCompanyName") as TextBox; TextBox txtContactName = e.Item.FindControl("txtContactName") as TextBox; TextBox txtAddress = e.Item.FindControl("txtAddress") as TextBox; TextBox txtEmail = e.Item.FindControl("txtEmail") as TextBox; TextBox txtPhone1 = e.Item.FindControl("txtPhone1") as TextBox; TextBox txtPhone2 = e.Item.FindControl("txtPhone2") as TextBox; TextBox txtQQ = e.Item.FindControl("txtQQ") as TextBox; TextBox txtOthers = e.Item.FindControl("txtOthers") as TextBox; HiddenField hfId = e.Item.FindControl("hfId") as HiddenField; CustomerDAL dal = new CustomerDAL(); var customer = dal.GetCustomerById(int.Parse(hfId.Value)); customer.CustomerCompanyName = txtCustomerCompanyName.Text; customer.ContactName = txtContactName.Text; customer.Address = txtAddress.Text; customer.Email = txtEmail.Text; customer.Phone1 = txtPhone1.Text; customer.Phone2 = txtPhone2.Text; customer.QQ = txtQQ.Text; customer.CustomerOthers = txtOthers.Text; dal.Save(); } } BindRepeater(); SetFocus(source); }