/// <summary> /// اطلاعات /// </summary> /// <param name="pCode">کد object</param> /// <returns>Boolean</returns> public void GetData(int pCode) { JDataBase db = new JDataBase(); try { if (pCode == 0) { db.setQuery(@"SELECT * FROM " + JTableNamesAutomation.Emprise); } else { db.setQuery(@"SELECT * FROM " + JTableNamesAutomation.Emprise + " WHERE " + Emprise.Code + "=" + pCode.ToString()); } db.Query_DataReader(); Items = new JAEmprise[db.RecordCount]; int count = 0; if (db.DataReader.Read()) { Items[count] = new JAEmprise(); JTable.SetToClassProperty(Items[count], db.DataReader); count++; } } finally { db.Dispose(); } }
private void btnSave_Click(object sender, EventArgs e) { JAEmprise tmp = new JAEmprise(); tmp.Description = txtDesc.Text; tmp.User_post_code = JMainFrame.CurrentPostCode; if (tmp.Insert() > 0) { JMessages.Message("Register Successfully ", "", JMessageType.Information); FillGrid(); } else { JMessages.Message("Register Not Successfully ", "", JMessageType.Error); } }
private void btnDelete_Click(object sender, EventArgs e) { JAEmprise tmp = new JAEmprise(); if (_Code != 0) { if (tmp.Delete(_Code)) { JMessages.Message("Delete Successfully ", "", JMessageType.Information); FillGrid(); } else { JMessages.Message("Delete Not Successfully ", "", JMessageType.Error); } } else { JMessages.Message("Please Selected Item ", "", JMessageType.Error); } }
private void btnEdit_Click(object sender, EventArgs e) { JAEmprise tmp = new JAEmprise(); tmp.Code = _Code; tmp.Description = txtDesc.Text; tmp.User_post_code = JMainFrame.CurrentPostCode; if (_Code != 0) { if (tmp.Update()) { JMessages.Message("Update Successfully ", "", JMessageType.Information); FillGrid(); } else { JMessages.Message("Update Not Successfully ", "", JMessageType.Error); } } else { JMessages.Message("Please Selected Item ", "", JMessageType.Error); } }
private void FillGrid() { JAEmprise tmp = new JAEmprise(); GvEmprise.DataSource = tmp.GetDataByCode(0); }