public void postmaster_item(AppLogic.Item item) { SqlConnection conWH = new SqlConnection(cs); SqlCommand cmdWH = new SqlCommand("INSERT INTO item_mast([iname],[idesc],[ibarcode],[main_cat_id],[sub_cat_id],[uom_purchase_id],[uom_consumption_id],[divisible_uop],[default_wh],[uid],[account_id]) values('" + item.iname + "','" + item.idesc + "','" + item.ibarcode + "'," + item.main_cat_id + "," + item.sub_cat_id + "," + item.uom_purchase_id + "," + item.uom_consumption_id + "," + item.divisible_uop + ",1," + item.uid + "," + item.acc_id + ")", conWH); try { conWH.Open(); cmdWH.ExecuteNonQuery(); conWH.Close(); // SqlConnection updcon = new SqlConnection(cs); SqlCommand updcmd = new SqlCommand("update item_mast set ibarcode=concat(main_cat_id,sub_cat_id,id) where ibarcode=concat(main_cat_id,sub_cat_id,iname)", updcon); updcon.Open(); updcmd.ExecuteNonQuery(); updcon.Close(); errTrue = false; } catch (Exception ex) { conWH.Close(); repText = ex.ToString(); errTrue = true; //throw; } }
public void postmaster_item_update(AppLogic.Item item, int get_itemid) { SqlConnection conWH = new SqlConnection(cs); SqlCommand cmdWH = new SqlCommand("update item_mast set [idesc]='" + item.idesc + "' , [ibarcode]='" + item.ibarcode + "' , [main_cat_id]=" + item.main_cat_id + " , [sub_cat_id]=" + item.sub_cat_id + ", [uom_purchase_id]=" + item.uom_purchase_id + " ,[uom_consumption_id]=" + item.uom_consumption_id + " , [divisible_uop]=" + item.divisible_uop + " where id=" + get_itemid, conWH); try { conWH.Open(); cmdWH.ExecuteNonQuery(); conWH.Close(); errTrue = false; } catch (Exception ex) { conWH.Close(); repText = ex.ToString(); errTrue = true; } }