public void AddNewMachine(int locationType, int govId, int civilId, int healthOfficeId, string ip, bool status) { Where.LocationTypeId.Value = locationType; if(govId!=-1) Where.GovId.Value = govId; if (civilId != -1) Where.CivilId.Value = civilId; if (healthOfficeId != -1) Where.HealthOfficeId.Value = healthOfficeId; if (!Query.Load()) { AddNew(); MachineId = Guid.NewGuid(); LocationTypeId = locationType; if (govId != -1) GovId = govId; if (civilId != -1) CivilId = (short)civilId; if (healthOfficeId != -1) HealthOfficeId = healthOfficeId; Save(); } OrganizationMachineIP orgMachineIp = new OrganizationMachineIP(); orgMachineIp.AddNewMachineDeatils(MachineId, ip, status); }
protected void lnkDelete_Click(object sender, EventArgs e) { try { Button delbtn = (Button)sender; string[] strIds = delbtn.CommandArgument.Split(','); Guid machineId = new Guid(strIds[0]); Guid orgId = new Guid(strIds[1]); OrganizationMachineIP prgMachineIP = new OrganizationMachineIP(); prgMachineIP.DeleteOrgIp(orgId); try { Machine machine = new Machine(); machine.DeleteMachine(machineId); } catch (Exception ex) { } LoadGridData(); } catch (Exception ex) { lblMsg.Text = "توجد مشكلة في الحذف"; } }
public void UpdateMachine(Guid machineId, Guid orgIpId, int locationType, int govId, int civilId, int healthOfficeId, string ip, bool status) { this.LoadByPrimaryKey(machineId); LocationTypeId = locationType; if (govId != -1) GovId = govId; else SetColumnNull("GovId"); if (civilId != -1) CivilId = (short)civilId; else SetColumnNull("CivilId"); if (healthOfficeId != -1) HealthOfficeId = healthOfficeId; else SetColumnNull("HealthOfficeId"); Save(); OrganizationMachineIP orgIp = new OrganizationMachineIP(); orgIp.UpdateMachineDeatils(orgIpId, ip, status); }