public static int update(ModelSalesContract model) { string strSQL = @" UPDATE sales_contract SET id_company = @id_company, id_admin = @id_admin, time_sign = @time_sign, time_create = @time_create, photo_urls = @photo_urls, comment = @comment, is_deleted = @is_deleted WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[8]; aryParams[0] = new MySqlParameter("@id_company", model.id_company); aryParams[1] = new MySqlParameter("@id_admin", model.id_admin); aryParams[2] = new MySqlParameter("@time_sign", model.time_sign); aryParams[3] = new MySqlParameter("@time_create", model.time_create); aryParams[4] = new MySqlParameter("@photo_urls", model.photo_urls); aryParams[5] = new MySqlParameter("@comment", model.comment); aryParams[6] = new MySqlParameter("@is_deleted", model.is_deleted); aryParams[7] = new MySqlParameter("@id", model.id); return(HelperMySql.ExecuteNonQuery(strSQL, aryParams)); }
public static int add(ModelInventoryRecord model) { string strSQL = @" INSERT INTO inventory_record ( id_contract, id_goods, amount_real, amount_stock, amount_fill ) VALUES ( @id_contract, @id_goods, @amount_real, @amount_stock, @amount_fill )"; MySqlParameter[] aryParams = new MySqlParameter[5]; aryParams[0] = new MySqlParameter("@id_contract", model.id_contract); aryParams[1] = new MySqlParameter("@id_goods", model.id_goods); aryParams[2] = new MySqlParameter("@amount_real", model.amount_real); aryParams[3] = new MySqlParameter("@amount_stock", model.amount_stock); aryParams[4] = new MySqlParameter("@amount_fill", model.amount_fill); if (HelperMySql.ExecuteNonQuery(strSQL, aryParams) > 0) { strSQL = "SELECT MAX(id) FROM inventory_record"; object objReturn = HelperMySql.ExecuteScalar(strSQL); return(objReturn == null ? 0 : Convert.ToInt32(objReturn)); } else { return(0); } }
public static int add(ModelCheckoutRecord model) { string strSQL = @" INSERT INTO checkout_record ( id_contract, id_goods, amount ) VALUES ( @id_contract, @id_goods, @amount )"; MySqlParameter[] aryParams = new MySqlParameter[3]; aryParams[0] = new MySqlParameter("@id_contract", model.id_contract); aryParams[1] = new MySqlParameter("@id_goods", model.id_goods); aryParams[2] = new MySqlParameter("@amount", model.amount); if (HelperMySql.ExecuteNonQuery(strSQL, aryParams) > 0) { strSQL = "SELECT MAX(id) FROM checkout_record"; object objReturn = HelperMySql.ExecuteScalar(strSQL); return(objReturn == null ? 0 : Convert.ToInt32(objReturn)); } else { return(0); } }
public static int update(ModelCheckoutContract model) { string strSQL = @" UPDATE checkout_contract SET id_admin = @id_admin, time_create = @time_create, name_unit = @name_unit, name_department = @name_department, name_sign = @name_sign, photo_urls = @photo_urls, comment = @comment, flag = @flag WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[9]; aryParams[0] = new MySqlParameter("@id_admin", model.id_admin); aryParams[1] = new MySqlParameter("@time_create", model.time_create); aryParams[2] = new MySqlParameter("@name_unit", model.name_unit); aryParams[3] = new MySqlParameter("@name_department", model.name_department); aryParams[4] = new MySqlParameter("@name_sign", model.name_sign); aryParams[5] = new MySqlParameter("@photo_urls", model.photo_urls); aryParams[6] = new MySqlParameter("@comment", model.comment); aryParams[7] = new MySqlParameter("@flag", model.flag); aryParams[8] = new MySqlParameter("@id", model.id); return((int)HelperMySql.ExecuteNonQuery(strSQL, aryParams)); }
public static void update(ModelInventoryContract model) { string strSQL = @" UPDATE inventory_contract SET id_admin = @id_admin, name_sign = @name_sign, time_create = @time_create, photo_urls = @photo_urls, comment = @comment, time_start = @time_start, time_end = @time_end WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[8]; aryParams[0] = new MySqlParameter("@id_admin", model.id_admin); aryParams[1] = new MySqlParameter("@name_sign", model.name_sign); aryParams[2] = new MySqlParameter("@time_create", model.time_create); aryParams[3] = new MySqlParameter("@photo_urls", model.photo_urls); aryParams[4] = new MySqlParameter("@comment", model.comment); aryParams[5] = new MySqlParameter("@time_start", model.time_start); aryParams[6] = new MySqlParameter("@time_end", model.time_end); aryParams[7] = new MySqlParameter("@id", model.id); HelperMySql.ExecuteNonQuery(strSQL, aryParams); }
public static int add(ModelSalesCompany model) { string strSQL = @" INSERT INTO sales_company ( name, id_admin, time_create, is_deleted ) VALUES ( @name, @id_admin, @time_create, @is_deleted )"; MySqlParameter[] aryParams = new MySqlParameter[4]; aryParams[0] = new MySqlParameter("@name", model.name); aryParams[1] = new MySqlParameter("@id_admin", model.id_admin); aryParams[2] = new MySqlParameter("@time_create", model.time_create); aryParams[3] = new MySqlParameter("@is_deleted", model.is_deleted); if (HelperMySql.ExecuteNonQuery(strSQL, aryParams) > 0) { strSQL = "SELECT MAX(id) FROM sales_company"; object objReturn = HelperMySql.ExecuteScalar(strSQL); return(objReturn == null ? 0 : Convert.ToInt32(objReturn)); } else { return(0); } }
public static void deleteById(int intId) { string strSQL = @"DELETE FROM sales_contract WHERE id=@id"; MySqlParameter[] aryParams = new MySqlParameter[1]; aryParams[0] = new MySqlParameter("@id", intId); HelperMySql.ExecuteNonQuery(strSQL, aryParams); }
public static int add(ModelAdmin model) { string strSQL = @" INSERT INTO sys_admin ( username, password, salt, real_name, id_card, mobile_phone, avatar_url, time_add, time_last_login, enabled, purviews, is_deleted ) VALUES ( @username, @password, @salt, @real_name, @id_card, @mobile_phone, @avatar_url, @time_add, @time_last_login, @enabled, @purviews, @is_deleted )"; MySqlParameter[] aryParams = new MySqlParameter[12]; aryParams[0] = new MySqlParameter("@username", model.username); aryParams[1] = new MySqlParameter("@password", model.password); aryParams[2] = new MySqlParameter("@salt", model.salt); aryParams[3] = new MySqlParameter("@real_name", model.real_name); aryParams[4] = new MySqlParameter("@id_card", model.id_card); aryParams[5] = new MySqlParameter("@mobile_phone", model.mobile_phone); aryParams[6] = new MySqlParameter("@avatar_url", model.avatar_url); aryParams[7] = new MySqlParameter("@time_add", model.time_add); aryParams[8] = new MySqlParameter("@time_last_login", model.time_last_login); aryParams[9] = new MySqlParameter("@enabled", model.enabled); aryParams[10] = new MySqlParameter("@purviews", model.purviews); aryParams[11] = new MySqlParameter("@is_deleted", model.is_deleted); if (HelperMySql.ExecuteNonQuery(strSQL, aryParams) > 0) { strSQL = "SELECT MAX(id) FROM sys_admin"; object objReturn = HelperMySql.ExecuteScalar(strSQL); return(objReturn == null ? 0 : Convert.ToInt32(objReturn)); } else { return(0); } }
/// <summary> /// 将某货品的库存数清零 /// </summary> /// <param name="intId">货品id</param> /// <returns></returns> public static int clearAmountStock(int intId) { string strSQL = @" UPDATE sales_goods SET amount_stock = 0 WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[1]; aryParams[0] = new MySqlParameter("@id", intId); return(HelperMySql.ExecuteNonQuery(strSQL, aryParams)); }
public static void deleteById(int intId) { string strSQL = @" DELETE FROM sys_admin WHERE id = @id AND username <> 'rush2112' OR username <> 'wumin' "; MySqlParameter[] aryParams = new MySqlParameter[1]; aryParams[0] = new MySqlParameter("@id", intId); HelperMySql.ExecuteNonQuery(strSQL, aryParams); }
public static void deleteById(int intId) { // 删除某盘点单要先删除此盘点单下所有盘点记录 string strSQL = @"DELETE FROM inventory_record WHERE id_contract = @id_contract"; MySqlParameter[] aryParams = new MySqlParameter[1]; aryParams[0] = new MySqlParameter("@id_contract", intId); HelperMySql.ExecuteNonQuery(strSQL, aryParams); // 删除某盘点单 strSQL = @"DELETE FROM inventory_contract WHERE id = @id"; aryParams = new MySqlParameter[1]; aryParams[0] = new MySqlParameter("@id", intId); HelperMySql.ExecuteNonQuery(strSQL, aryParams); }
/// <summary> /// 设置货品的所属入库单 /// </summary> /// <param name="intId"></param> /// <param name="intContractId"></param> public static void updateContractId(int intId, int intContractId) { string strSQL = @" UPDATE sales_goods SET id_contract = @id_contract WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[2]; aryParams[0] = new MySqlParameter("@id_contract", intContractId); aryParams[1] = new MySqlParameter("@id", intId); HelperMySql.ExecuteNonQuery(strSQL, aryParams); }
public static int updateAmountById(decimal dcmAmount, int intId) { string strSQL = @" UPDATE checkout_record SET amount = @amount WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[2]; aryParams[0] = new MySqlParameter("@amount", dcmAmount); aryParams[1] = new MySqlParameter("@id", intId); return(HelperMySql.ExecuteNonQuery(strSQL, aryParams)); }
// 当删除一条出货记录时,要将这条货品的出货数量加回到库存里 public static int addAmountStock(int intGoodsId, decimal dcmAmountOut) { string strSQL = @" UPDATE sales_goods SET amount_stock = amount_stock + @amountOut WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[2]; aryParams[0] = new MySqlParameter("@amountOut", dcmAmountOut); aryParams[1] = new MySqlParameter("@id", intGoodsId); return(HelperMySql.ExecuteNonQuery(strSQL, aryParams)); }
/// <summary> /// 盘点时,将某货品的库存数设置为盘点数 /// 本来货品的库存数是实时计算的,但是由于各种原因,库存数和盘点数对不上 /// 因此根据老敏要求,盘点时直接将库存数修改为盘点数 /// </summary> /// <param name="dcmAmountInventoryShow"></param> /// <param name="intId"></param> /// <returns></returns> public static int updateAmountStockByInventory(decimal dcmAmountInventoryShow, int intId) { string strSQL = @" UPDATE sales_goods SET amount_stock = @AmountInventoryShow WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[2]; aryParams[0] = new MySqlParameter("@AmountInventoryShow", dcmAmountInventoryShow); aryParams[1] = new MySqlParameter("@id", intId); return(HelperMySql.ExecuteNonQuery(strSQL, aryParams)); }
/// <summary> /// 修改盘点记录的真实计算库存数 /// </summary> public static void updateRealById(decimal dcmAmountReal, int intId) { string strSQL = @" UPDATE inventory_record SET amount_real = @amount_real WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[2]; aryParams[0] = new MySqlParameter("@amount_real", dcmAmountReal); aryParams[1] = new MySqlParameter("@id", intId); HelperMySql.ExecuteNonQuery(strSQL, aryParams); }
public static int update(ModelSalesGoods model) { string strSQL = @" UPDATE sales_goods SET id_contract = @id_contract, name_product = @name_product, type = @type, name_factory = @name_factory, unit = @unit, amount = @amount, price_unit = @price_unit, price_total = @price_total, batch_number = @batch_number, validity_period = @validity_period, approval_number = @approval_number, comment = @comment, photo_urls = @photo_urls, id_admin = @id_admin, time_add = @time_add, amount_stock = @amount_stock WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[17]; aryParams[0] = new MySqlParameter("@id_contract", model.id_contract); aryParams[1] = new MySqlParameter("@name_product", model.name_product); aryParams[2] = new MySqlParameter("@type", model.type); aryParams[3] = new MySqlParameter("@name_factory", model.name_factory); aryParams[4] = new MySqlParameter("@unit", model.unit); aryParams[5] = new MySqlParameter("@amount", model.amount); aryParams[6] = new MySqlParameter("@price_unit", model.price_unit); aryParams[7] = new MySqlParameter("@price_total", model.price_total); aryParams[8] = new MySqlParameter("@batch_number", model.batch_number); aryParams[9] = new MySqlParameter("@validity_period", model.validity_period); aryParams[10] = new MySqlParameter("@approval_number", model.approval_number); aryParams[11] = new MySqlParameter("@comment", model.comment); aryParams[12] = new MySqlParameter("@photo_urls", model.photo_urls); aryParams[13] = new MySqlParameter("@id_admin", model.id_admin); aryParams[14] = new MySqlParameter("@time_add", model.time_add); aryParams[15] = new MySqlParameter("@amount_stock", model.amount_stock); aryParams[16] = new MySqlParameter("@id", model.id); return(HelperMySql.ExecuteNonQuery(strSQL, aryParams)); }
public static int add(ModelCheckoutContract model) { string strSQL = @" INSERT INTO checkout_contract ( id_admin, time_create, name_unit, name_department, name_sign, photo_urls, comment, flag ) VALUES ( @id_admin, @time_create, @name_unit, @name_department, @name_sign, @photo_urls, @comment, @flag )"; MySqlParameter[] aryParams = new MySqlParameter[8]; aryParams[0] = new MySqlParameter("@id_admin", model.id_admin); aryParams[1] = new MySqlParameter("@time_create", model.time_create); aryParams[2] = new MySqlParameter("@name_unit", model.name_unit); aryParams[3] = new MySqlParameter("@name_department", model.name_department); aryParams[4] = new MySqlParameter("@name_sign", model.name_sign); aryParams[5] = new MySqlParameter("@photo_urls", model.photo_urls); aryParams[6] = new MySqlParameter("@comment", model.comment); aryParams[7] = new MySqlParameter("@flag", model.flag); if (HelperMySql.ExecuteNonQuery(strSQL, aryParams) > 0) { strSQL = "SELECT MAX(id) FROM checkout_contract"; object objReturn = HelperMySql.ExecuteScalar(strSQL); return(objReturn == null ? 0 : Convert.ToInt32(objReturn)); } else { return(0); } }
public static int update(ModelCheckoutRecord model) { string strSQL = @" UPDATE checkout_record SET id_contract = @id_contract, id_goods = @id_goods, amount = @amount WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[4]; aryParams[0] = new MySqlParameter("@id_contract", model.id_contract); aryParams[1] = new MySqlParameter("@id_goods", model.id_goods); aryParams[2] = new MySqlParameter("@amount", model.amount); aryParams[3] = new MySqlParameter("@id", model.id); return(HelperMySql.ExecuteNonQuery(strSQL, aryParams)); }
public static void update(ModelMedicalRecord model) { string strSQL = @" UPDATE medical_record SET sickbed_number = @sickbed_number, name_real = @name_real, sex = @sex, birthday = @birthday, department = @department, name_disease = @name_disease, time_in = @time_in, time_out = @time_out, situation_out = @situation_out, situation_in = @situation_in, photo_urls = @photo_urls, comment = @comment, time_create = @time_create, id_admin = @id_admin, is_deleted = @is_deleted WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[16]; aryParams[0] = new MySqlParameter("@sickbed_number", model.sickbed_number); aryParams[1] = new MySqlParameter("@name_real", model.name_real); aryParams[2] = new MySqlParameter("@sex", model.sex); aryParams[3] = new MySqlParameter("@birthday", model.birthday); aryParams[4] = new MySqlParameter("@department", model.department); aryParams[5] = new MySqlParameter("@name_disease", model.name_disease); aryParams[6] = new MySqlParameter("@time_in", model.time_in); aryParams[7] = new MySqlParameter("@time_out", model.time_out); aryParams[8] = new MySqlParameter("@situation_out", model.situation_out); aryParams[9] = new MySqlParameter("@situation_in", model.situation_in); aryParams[10] = new MySqlParameter("@photo_urls", model.photo_urls); aryParams[11] = new MySqlParameter("@comment", model.comment); aryParams[12] = new MySqlParameter("@time_create", model.time_create); aryParams[13] = new MySqlParameter("@id_admin", model.id_admin); aryParams[14] = new MySqlParameter("@is_deleted", model.is_deleted); aryParams[15] = new MySqlParameter("@id", model.id); HelperMySql.ExecuteNonQuery(strSQL, aryParams); }
public static void update(ModelAdmin model) { if ("rush2112".Equals(model.username) || "wumin".Equals(model.username)) { model.purviews = "SUPERADMIN"; } string strSQL = @" UPDATE sys_admin SET username = @username, password = @password, salt = @salt, real_name = @real_name, id_card = @id_card, mobile_phone = @mobile_phone, avatar_url = @avatar_url, time_add = @time_add, time_last_login = @time_last_login, enabled = @enabled, purviews = @purviews, is_deleted = @is_deleted WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[13]; aryParams[0] = new MySqlParameter("@username", model.username); aryParams[1] = new MySqlParameter("@password", model.password); aryParams[2] = new MySqlParameter("@salt", model.salt); aryParams[3] = new MySqlParameter("@real_name", model.real_name); aryParams[4] = new MySqlParameter("@id_card", model.id_card); aryParams[5] = new MySqlParameter("@mobile_phone", model.mobile_phone); aryParams[6] = new MySqlParameter("@avatar_url", model.avatar_url); aryParams[7] = new MySqlParameter("@time_add", model.time_add); aryParams[8] = new MySqlParameter("@time_last_login", model.time_last_login); aryParams[9] = new MySqlParameter("@enabled", model.enabled); aryParams[10] = new MySqlParameter("@purviews", model.purviews); aryParams[11] = new MySqlParameter("@is_deleted", model.is_deleted); aryParams[12] = new MySqlParameter("@id", model.id); HelperMySql.ExecuteNonQuery(strSQL, aryParams); }
public static int update(ModelSalesCompany model) { string strSQL = @" UPDATE sales_company SET name = @name, id_admin = @id_admin, time_create = @time_create, is_deleted = @is_deleted WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[5]; aryParams[0] = new MySqlParameter("@name", model.name); aryParams[1] = new MySqlParameter("@id_admin", model.id_admin); aryParams[2] = new MySqlParameter("@time_create", model.time_create); aryParams[3] = new MySqlParameter("@is_deleted", model.is_deleted); aryParams[4] = new MySqlParameter("@id", model.id); return(HelperMySql.ExecuteNonQuery(strSQL, aryParams)); }
public static void changeIsDeleted(int intID) { string strSQL = @"UPDATE sales_contract SET is_deleted = 1 WHERE id = @id"; MySqlParameter[] aryParams = new MySqlParameter[1]; aryParams[0] = new MySqlParameter("@id", intID); HelperMySql.ExecuteNonQuery(strSQL, aryParams); //if (intID <= 0) return; //int intIsDeleted = 0; //string strSQL = "SELECT is_deleted FROM sales_contract WHERE id = @id"; //MySqlParameter[] aryParams = new MySqlParameter[1]; //aryParams[0] = new MySqlParameter("@id", intID); //intIsDeleted = Convert.ToInt16(HelperMySql.ExecuteScalar(strSQL, aryParams)); //if (intIsDeleted == 1) // strSQL = @"UPDATE sales_contract SET is_deleted = 0 WHERE id = @id"; //else // strSQL = @"UPDATE sales_contract SET is_deleted = 1 WHERE id = @id"; //aryParams = new MySqlParameter[1]; //aryParams[0] = new MySqlParameter("@id", intID); //HelperMySql.ExcuteNoQuery(strSQL, aryParams); }
public static int add(ModelSalesContract model) { string strSQL = @" INSERT INTO sales_contract ( id_company, id_admin, time_sign, time_create, photo_urls, comment, is_deleted ) VALUES ( @id_company, @id_admin, @time_sign, @time_create, @photo_urls, @comment, @is_deleted )"; MySqlParameter[] aryParams = new MySqlParameter[7]; aryParams[0] = new MySqlParameter("@id_company", model.id_company); aryParams[1] = new MySqlParameter("@id_admin", model.id_admin); aryParams[2] = new MySqlParameter("@time_sign", model.time_sign); aryParams[3] = new MySqlParameter("@time_create", model.time_create); aryParams[4] = new MySqlParameter("@photo_urls", model.photo_urls); aryParams[5] = new MySqlParameter("@comment", model.comment); aryParams[6] = new MySqlParameter("@is_deleted", model.is_deleted); if (HelperMySql.ExecuteNonQuery(strSQL, aryParams) > 0) { strSQL = "SELECT MAX(id) FROM sales_contract"; object objReturn = HelperMySql.ExecuteScalar(strSQL); return(objReturn == null ? 0 : Convert.ToInt32(objReturn)); } else { return(0); } }
public static void update(ModelInventoryRecord model) { string strSQL = @" UPDATE inventory_record SET id_contract = @id_contract, id_goods = @id_goods, amount_real = @amount_real, amount_stock = @amount_stock, amount_fill = @amount_fill WHERE id = @id "; MySqlParameter[] aryParams = new MySqlParameter[6]; aryParams[0] = new MySqlParameter("@id_contract", model.id_contract); aryParams[1] = new MySqlParameter("@id_goods", model.id_goods); aryParams[2] = new MySqlParameter("@amount_real", model.amount_real); aryParams[3] = new MySqlParameter("@amount_stock", model.amount_stock); aryParams[4] = new MySqlParameter("@amount_fill", model.amount_fill); aryParams[5] = new MySqlParameter("@id", model.id); HelperMySql.ExecuteNonQuery(strSQL, aryParams); }
public static void changeIsDeleted(int intAdminID) { if (intAdminID <= 0) { return; } int intIsDeleted = 0; string strSQL = "SELECT is_deleted FROM sys_admin WHERE id = @id"; MySqlParameter[] aryParams = new MySqlParameter[1]; aryParams[0] = new MySqlParameter("@id", intAdminID); intIsDeleted = Convert.ToInt16(HelperMySql.ExecuteScalar(strSQL, aryParams)); if (intIsDeleted == 1) { strSQL = @"UPDATE sys_admin SET is_deleted = 0 WHERE id = @id"; } else { strSQL = @"UPDATE sys_admin SET is_deleted = 1 WHERE id = @id"; } aryParams = new MySqlParameter[1]; aryParams[0] = new MySqlParameter("@id", intAdminID); HelperMySql.ExecuteNonQuery(strSQL, aryParams); }
public static int add(ModelSalesGoods model) { string strSQL = @" INSERT INTO sales_goods ( id_contract, name_product, type, name_factory, unit, amount, price_unit, price_total, batch_number, validity_period, approval_number, comment, photo_urls, id_admin, time_add, amount_stock ) VALUES ( @id_contract, @name_product, @type, @name_factory, @unit, @amount, @price_unit, @price_total, @batch_number, @validity_period, @approval_number, @comment, @photo_urls, @id_admin, @time_add, @amount_stock )"; MySqlParameter[] aryParams = new MySqlParameter[16]; aryParams[0] = new MySqlParameter("@id_contract", model.id_contract); aryParams[1] = new MySqlParameter("@name_product", model.name_product); aryParams[2] = new MySqlParameter("@type", model.type); aryParams[3] = new MySqlParameter("@name_factory", model.name_factory); aryParams[4] = new MySqlParameter("@unit", model.unit); aryParams[5] = new MySqlParameter("@amount", model.amount); aryParams[6] = new MySqlParameter("@price_unit", model.price_unit); aryParams[7] = new MySqlParameter("@price_total", model.price_total); aryParams[8] = new MySqlParameter("@batch_number", model.batch_number); aryParams[9] = new MySqlParameter("@validity_period", model.validity_period); aryParams[10] = new MySqlParameter("@approval_number", model.approval_number); aryParams[11] = new MySqlParameter("@comment", model.comment); aryParams[12] = new MySqlParameter("@photo_urls", model.photo_urls); aryParams[13] = new MySqlParameter("@id_admin", model.id_admin); aryParams[14] = new MySqlParameter("@time_add", model.time_add); aryParams[15] = new MySqlParameter("@amount_stock", model.amount_stock); if (HelperMySql.ExecuteNonQuery(strSQL, aryParams) > 0) { strSQL = "SELECT MAX(id) FROM sales_goods"; object objReturn = HelperMySql.ExecuteScalar(strSQL); return(objReturn == null ? 0 : Convert.ToInt32(objReturn)); } else { return(0); } }
public static int add(ModelMedicalRecord model) { string strSQL = @" INSERT INTO medical_record ( sickbed_number, name_real, sex, birthday, department, name_disease, time_in, time_out, situation_out, situation_in, photo_urls, comment, time_create, id_admin, is_deleted ) VALUES ( @sickbed_number, @name_real, @sex, @birthday, @department, @name_disease, @time_in, @time_out, @situation_out, @situation_in, @photo_urls, @comment, @time_create, @id_admin, @is_deleted )"; MySqlParameter[] aryParams = new MySqlParameter[15]; aryParams[0] = new MySqlParameter("@sickbed_number", model.sickbed_number); aryParams[1] = new MySqlParameter("@name_real", model.name_real); aryParams[2] = new MySqlParameter("@sex", model.sex); aryParams[3] = new MySqlParameter("@birthday", model.birthday); aryParams[4] = new MySqlParameter("@department", model.department); aryParams[5] = new MySqlParameter("@name_disease", model.name_disease); aryParams[6] = new MySqlParameter("@time_in", model.time_in); aryParams[7] = new MySqlParameter("@time_out", model.time_out); aryParams[8] = new MySqlParameter("@situation_out", model.situation_out); aryParams[9] = new MySqlParameter("@situation_in", model.situation_in); aryParams[10] = new MySqlParameter("@photo_urls", model.photo_urls); aryParams[11] = new MySqlParameter("@comment", model.comment); aryParams[12] = new MySqlParameter("@time_create", model.time_create); aryParams[13] = new MySqlParameter("@id_admin", model.id_admin); aryParams[14] = new MySqlParameter("@is_deleted", model.is_deleted); if (HelperMySql.ExecuteNonQuery(strSQL, aryParams) > 0) { strSQL = "SELECT MAX(id) FROM medical_record"; object objReturn = HelperMySql.ExecuteScalar(strSQL); return(objReturn == null ? 0 : Convert.ToInt32(objReturn)); } else { return(0); } }