public static void SaveKELENGKAPANMap(string varKODEPBJ, string[] itemList) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM KELENGKAPANPBJ WHERE KODEBPJ=@KODEBPJ", PBJ.Schema.Provider.Name); cmdDel.AddParameter("@KODEBPJ", varKODEPBJ); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (string item in itemList) { KELENGKAPANPBJ varKELENGKAPANPBJ = new KELENGKAPANPBJ(); varKELENGKAPANPBJ.SetColumnValue("KODEBPJ", varKODEPBJ); varKELENGKAPANPBJ.SetColumnValue("KODEKELENGKAPAN", item); varKELENGKAPANPBJ.Save(); } }
public static void SavePBJMap(string varKODEKELENGKAPAN, System.Web.UI.WebControls.ListItemCollection itemList) { QueryCommandCollection coll = new SubSonic.QueryCommandCollection(); //delete out the existing QueryCommand cmdDel = new QueryCommand("DELETE FROM KELENGKAPANPBJ WHERE KODEKELENGKAPAN=@KODEKELENGKAPAN", KELENGKAPAN.Schema.Provider.Name); cmdDel.AddParameter("@KODEKELENGKAPAN", varKODEKELENGKAPAN); coll.Add(cmdDel); DataService.ExecuteTransaction(coll); foreach (System.Web.UI.WebControls.ListItem l in itemList) { if (l.Selected) { KELENGKAPANPBJ varKELENGKAPANPBJ = new KELENGKAPANPBJ(); varKELENGKAPANPBJ.SetColumnValue("KODEKELENGKAPAN", varKODEKELENGKAPAN); varKELENGKAPANPBJ.SetColumnValue("KODEBPJ", l.Value); varKELENGKAPANPBJ.Save(); } } }