private void btnSynch_Click(object sender, System.EventArgs e) { if (this.Clinic == null || this.Clinic.Id == 0) { return; } var dialogResult = Medical.Forms.UI.MessageDialog.Instance.ShowMessage(this, "Q009", this.Clinic.Name); if (dialogResult == DialogResult.No) { return; } // Update tu server List <TableChange> lstServer = tableChangeServerRep.GetByClinicId(1); Medicine _clientEntiy; Medicine _serverEntity; if (lstServer.Count > 0) { foreach (TableChange ent in lstServer) { switch (ent.TableName.ToString()) { case "Medicine": _serverEntity = medicineServerRep.GetById(ent.Id); if (ent.Action.Equals("I")) { if ((Medicine)medicineRep.GetById(ent.Id) == null) { _clientEntiy = new Medicine(); _clientEntiy = medicineRep.CopyEntity(_clientEntiy, _serverEntity); medicineRep.Insert(_clientEntiy); } } if (ent.Action.Equals("U")) { if ((Medicine)medicineRep.GetById(ent.Id) != null) { _clientEntiy = medicineRep.GetById(ent.Id); _clientEntiy = medicineRep.CopyEntity(_serverEntity, _clientEntiy); medicineRep.Update(_clientEntiy); } } break; case "Clinic": break; } } } }