public ProductModel ToModel() { return(new ProductModel { id = Id, name = Name, category = Category.ToModel(), calories = Calories, carbohydrates = Carbohydrates, fats = Fats, proteins = Proteins, defaultSize = Size, defaultUnit = DefaultUnit.ToModel() }); }
public DefaultUnit Query_DefaultUnitID(Guid mid) { SqlParameter[] para = { new SqlParameter("@default", SqlDbType.UniqueIdentifier), new SqlParameter("@name", SqlDbType.VarChar,20), new SqlParameter("@mid", SqlDbType.UniqueIdentifier) }; para[0].Direction = ParameterDirection.Output; para[1].Direction = ParameterDirection.Output; para[2].Value = mid; DefaultUnit ds = SqlHelper.ExecuteReturnGuidandNameQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "Proc_S_DefaultUnitID", para); return(ds); }
public static DefaultUnit ExecuteReturnGuidandNameQuery(string connectionString, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters) { SqlCommand cmd = new SqlCommand(); using (SqlConnection conn = new SqlConnection(connectionString)) { PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters); int val = cmd.ExecuteNonQuery(); string test = commandParameters[0].Value.ToString(); DefaultUnit du = new DefaultUnit(); du.Defaultid = new Guid(commandParameters[0].Value.ToString()); du.Name = commandParameters[1].Value.ToString(); return(du); } }
protected void Button39_Click(object sender, EventArgs e) { GridView6.DataSource = bom.Query_Unit(TextBox23.Text); GridView6.DataBind(); Label533.Text = "请选择单位"; TextBox24.Text = ""; DefaultUnit du = new DefaultUnit(); du = bom.Query_DefaultUnitID(new Guid(Label38.Text)); Label531.Text = du.Name; Label532.Text = du.Defaultid.ToString(); Panel53.Visible = true; Panel51.Visible = false; Panel5.Visible = true; Panel52.Visible = false; Panel6.Visible = false; UpdatePanel5.Update(); UpdatePanel6.Update(); }