public ssmtbl_CustomerModel GetOneCustomer(int Id) { ssmtbl_CustomerModel objtemp = new ssmtbl_CustomerModel(); try { var connection = gConnection.Connection(); connection.Open(); string sqlstr = "ssmsp_Get_AllVendor"; SqlCommand cmd = new SqlCommand(sqlstr, connection); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ID", Id); cmd.Parameters.AddWithValue("@Action", "GetCustomerByID"); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { objtemp.Name = sdr["Name"].ToString(); objtemp.Telephone_No = (sdr["Telephone_No"].ToString()); objtemp.GSTNo = (sdr["gst"].ToString()); objtemp.PANNo = (sdr["pan"].ToString()); objtemp.Remarks = sdr["Remarks"].ToString(); objtemp.Vendor_Code = sdr["Vendor_Code"].ToString(); objtemp.flag = Convert.ToBoolean(sdr["isActive"].ToString()); } connection.Close(); } catch (Exception ex) { ErrorHandlerClass.LogError(ex); } return(objtemp); }
public List <ssmtbl_CustomerModel> GetAllCustomer(string type) { List <ssmtbl_CustomerModel> objtempomerList = new List <ssmtbl_CustomerModel>(); try { var connection = gConnection.Connection(); connection.Open(); string sqlstr = "ssmsp_Get_AllVendor"; SqlCommand cmd = new SqlCommand(sqlstr, connection); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", "selectcustomer"); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { ssmtbl_CustomerModel objtemp = new ssmtbl_CustomerModel(); //objtemp.SN = Convert.ToInt32(sdr["SN"].ToString()); objtemp.ID = Convert.ToInt32(sdr["ID"].ToString()); objtemp.Name = sdr["Name"].ToString(); objtemp.Address = (sdr["Address"].ToString()); objtemp.Telephone_No = (sdr["Telephone_No"].ToString()); objtempomerList.Add(objtemp); } connection.Close(); } catch (Exception ex) { ErrorHandlerClass.LogError(ex); } return(objtempomerList); }
public ActionResult EditVendor(string id) { ssmtbl_CustomerModel objCustMod = new ssmtbl_CustomerModel(); DropDownSelection objDrop = new DropDownSelection(); ViewData["StateCodeDrpDwn"] = objDrop.State_CodeDropDown(); id = (id == null || id == "") ? "0" : id; objCustMod = objCustData.GetOneCustomer(Convert.ToInt32(id)); GlobalFunction objGFunc = new GlobalFunction(); objCustMod.VendorTypeListModel = objGFunc.VendorTypeList(); // var connection = gConnection.Connection(); connection.Open(); string sqlstr = "VendorPOType"; SqlCommand cmd = new SqlCommand(sqlstr, GlobalVariables.gConn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", "select"); cmd.Parameters.AddWithValue("@VendorId", id.Trim()); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); DataRow[] dr = new DataRow[dt.Rows.Count]; dt.Rows.CopyTo(dr, 0); int[] vtypeid = Array.ConvertAll(dr, new Converter <DataRow, int>(DataRowToDouble)); connection.Close(); // //int[] proinfo = new int [] { 1, 2 }; ViewData["vtype"] = vtypeid; return(View(objCustMod)); }
public ActionResult NewCustomer() { ssmtbl_CustomerModel objCustMod = new ssmtbl_CustomerModel(); DropDownSelection objDrop = new DropDownSelection(); ViewData["StateCodeDrpDwn"] = objDrop.State_CodeDropDown(); return(View(objCustMod)); }
public ActionResult EditCustomer(string id) { ssmtbl_CustomerModel objCustMod = new ssmtbl_CustomerModel(); DropDownSelection objDrop = new DropDownSelection(); ViewData["StateCodeDrpDwn"] = objDrop.State_CodeDropDown(); id = (id == null || id == "") ? "0" : id; objCustMod = objCustData.GetOneCustomer(Convert.ToInt32(id)); return(View(objCustMod)); }
public ActionResult NewVendor() { ssmtbl_CustomerModel objCustMod = new ssmtbl_CustomerModel(); objCustMod.Vendor_Code = objVendData.GetMaxVendorCode(); DropDownSelection objDrop = new DropDownSelection(); ViewData["StateCodeDrpDwn"] = objDrop.State_CodeDropDown(); GlobalFunction objGFunc = new GlobalFunction(); objCustMod.VendorTypeListModel = objGFunc.VendorTypeList(); return(View(objCustMod)); }