public int delete(int id) { AbstractCommonData entity = new AttachmentChequeReceiptEntity(); string delQuery = "DELETE FROM " + entity.TableName + " WHERE " + AttachmentChequeReceiptEntity.indexField + "=" + provider.getSQLString(id); return(provider.delete(delQuery)); }
private void fillGrid() { AttachmentChequeReceiptEntity entity = null; entity = _attachmentChequeReceiptBl.get(_receiptId); System.Collections.Hashtable hash = new Hashtable(); _gridTools.bindDataToGrid(dataGridView1, entity, null, hash); }
public AttachmentChequeReceiptEntity getById(int id) { AttachmentChequeReceiptEntity entity = new AttachmentChequeReceiptEntity(); String cond = AttachmentChequeReceiptEntity.FIELD_ID + "=" + provider.getSQLString(id); provider.loadToDataSet(entity, cond); return(entity); }
public int getCount(int letterid) { //ToDo reprogram this lines AttachmentChequeReceiptEntity entity = new AttachmentChequeReceiptEntity(); String sql = "SELECT COUNT(1) FROM " + entity.TableName + " WHERE " + AttachmentChequeReceiptEntity.FIELD_RECEIPT_ID + "=" + provider.getSQLString(letterid); String cond = AttachmentChequeReceiptEntity.FIELD_RECEIPT_ID + "=" + provider.getSQLString(letterid); provider.loadToDataSet(entity, cond); return(entity.Tables[entity.FilledTableName].Rows.Count); }
private void btnSave_Click(object sender, EventArgs e) { try { string s = openFileDialog1.FileName; if (s != null && s.Length > 0 && txtFullFileName.Text.Trim().Length > 0) { AttachmentChequeReceiptEntity entity = new AttachmentChequeReceiptEntity(); DataRow dr = entity.Tables[entity.TableName].NewRow(); dr[AttachmentChequeReceiptEntity.FIELD_RECEIPT_ID] = _receiptId; dr[AttachmentChequeReceiptEntity.FIELD_FILE_NAME] = txtFileName.Text; dr[AttachmentChequeReceiptEntity.FIELD_ID] = _id; dr[AttachmentChequeReceiptEntity.FIELD_CONTENT] = ReadFile(txtFullFileName.Text); entity.Tables[entity.TableName].Rows.Add(dr); if (_id > 0) { _attachmentChequeReceiptBL.update(entity); //lblMsg.Text = "به روز رسانی گردید"; } else { _id = _attachmentChequeReceiptBL.add(entity); //lblMsg.Text = "ذخیره شد "; } this.Close(); } } catch (Exception ex) { if (ex.Message != null && (ex.Message.IndexOf("cannot access the file ") >= 0 || ex.Message.IndexOf("") >= 0)) { MessageBox.Show("فایل مورد نظر توسط برنامه ای دیگر در حال استفاده است!" + "\n" + ex.Message); return; } } }
private void loadForm() { if (_id > 0) { try { AttachmentChequeReceiptEntity entity = _attachmentChequeReceiptBL.getById(_id); txtFileName.Text = entity.get(AttachmentChequeReceiptEntity.FIELD_FILE_NAME).ToString(); _fileName = txtFileName.Text; _imageData = (byte[])entity.Tables[entity.FilledTableName].Rows[0][AttachmentChequeReceiptEntity.FIELD_CONTENT]; if (isImage(txtFullFileName.Text)) { Image newImage; //Read image data into a memory stream using (MemoryStream ms = new MemoryStream(_imageData, 0, _imageData.Length)) { ms.Write(_imageData, 0, _imageData.Length); //Set image variable value using memory stream. newImage = Image.FromStream(ms, true); } pictureBox1.Height = newImage.Height; pictureBox1.Width = newImage.Width; pictureBox1.Image = newImage; pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; } else { displayNonImageFile(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
public int update(AttachmentChequeReceiptEntity entity) { return(provider.update(entity)); }
public int add(AttachmentChequeReceiptEntity entity) { return(provider.add(entity)); }
public int update(AttachmentChequeReceiptEntity entity) { return(((AttachmentChequeReceiptDA)_abstractDA).update(entity)); }
public int add(AttachmentChequeReceiptEntity entity) { return(((AttachmentChequeReceiptDA)_abstractDA).add(entity)); }