private void LoadData(DataTable dt_) { try { for (int i = 0; i < dt_.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt_.Rows[i]["ID"].ToString())) { supplier supplier = new supplier(); supplier.supplierId = dt_.Rows[i]["ID"].ToString(); supplier.suppliername = dt_.Rows[i]["Supplier Name"].ToString(); supplier.contactperson = dt_.Rows[i]["Contact Person"].ToString(); supplier.BackUpContact = dt_.Rows[i]["BackUp Contact"].ToString(); supplier.City_ = dt_.Rows[i]["City"].ToString(); supplier.phoneno = dt_.Rows[i]["Phone No"].ToString(); supplier.mobile = dt_.Rows[i]["Mobile"].ToString(); supplier.faxno = dt_.Rows[i]["Fax No"].ToString(); supplier.postalcode = dt_.Rows[i]["Postal Code"].ToString(); supplier.designation = dt_.Rows[i]["Designation"].ToString(); supplier.AddressOne = dt_.Rows[i]["Address One"].ToString(); supplier.AddressTwo = dt_.Rows[i]["Address Two"].ToString(); supplier.CNIC = dt_.Rows[i]["NIC"].ToString(); supplier.Url = dt_.Rows[i]["Url"].ToString(); supplier.BusinessNature = dt_.Rows[i]["Business Nature"].ToString(); supplier.Email = dt_.Rows[i]["Email"].ToString(); supplier.NTNNTRNo = dt_.Rows[i]["NTN/NTR No"].ToString(); supplier.CreatedBy = Session["user"].ToString(); supplier.CreatedDate = DateTime.Now; supplier.IsActive = "True"; SupplierManager supmanag = new SupplierManager(supplier); supmanag.Save(); FillGrid(); } } } catch (Exception ex) { //throw; ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true); lblalert.Text = ex.Message; } }
public SupplierManager(supplier _supplier) { supplier = _supplier; }