protected void EditAction(string eventType, object record) { try { partiDB.GetCourse claCourse = new partiDB.GetCourse(); Dictionary <string, object> KeyVal = record as Dictionary <string, object>; Parallel.ForEach(KeyVal, key => { if (key.Key == "id") { claCourse.id = (int)key.Value; } else if (key.Key == "name") { claCourse.name = (string)key.Value; } else if (key.Key == "description") { claCourse.description = (string)key.Value; } }); if (eventType == "endAdd") { //wcf add users wcf.parti.Service1 _parti = new wcf.parti.Service1(); var result = _parti.EditCourse("add", claCourse.id, true, claCourse.name, claCourse.description); ReloadData(result); _parti.LoggingAsync("set", "Course", "user: "******"username"].ToString() + " had add new Course: " + claCourse.name + " to system", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ""); } else if (eventType == "endEdit") { //wcf update data wcf.parti.Service1 _parti = new wcf.parti.Service1(); var result = _parti.EditCourse("edit", claCourse.id, true, claCourse.name, claCourse.description); ReloadData(result); _parti.LoggingAsync("set", "Course", "user: "******"username"].ToString() + " had edit a Course: " + claCourse.name + " on system", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ""); } else if (eventType == "endDelete") { //wcf delete data wcf.parti.Service1 _parti = new wcf.parti.Service1(); var result = _parti.EditCourse("del", claCourse.id, true, claCourse.name, claCourse.description); ReloadData(result); _parti.LoggingAsync("set", "Course", "user: "******"username"].ToString() + " had delete a Course: " + claCourse.name + " from system", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ""); } } catch (Exception ex) { MessageBox.swalModal(this.Page, "error", "en:internal error[" + ex.Message.Replace("'", "") + "]", ""); } }
protected void EditAction(string eventType, object record) { try { partiDB.GetCourse claCourse = new partiDB.GetCourse(); Dictionary <string, object> KeyVal = record as Dictionary <string, object>; Parallel.ForEach(KeyVal, key => { if (key.Key == "id") { claCourse.id = (int)key.Value; } else if (key.Key == "name") { claCourse.name = (string)key.Value; } else if (key.Key == "description") { claCourse.description = (string)key.Value; } }); if (eventType == "endAdd") { //wcf add users wcf.parti.Service1 _parti = new wcf.parti.Service1(); var result = _parti.EditCourse("add", claCourse.id, true, claCourse.name, claCourse.description); ReloadData(result); } else if (eventType == "endEdit") { //wcf update data wcf.parti.Service1 _parti = new wcf.parti.Service1(); var result = _parti.EditCourse("edit", claCourse.id, true, claCourse.name, claCourse.description); ReloadData(result); } else if (eventType == "endDelete") { //wcf delete data wcf.parti.Service1 _parti = new wcf.parti.Service1(); var result = _parti.EditCourse("del", claCourse.id, true, claCourse.name, claCourse.description); ReloadData(result); } } catch (Exception ex) { MessageBox.swalModal(this.Page, "error", "en:internal error[" + ex.Message.Replace("'", "") + "]", ""); } }