Exemple #1
0
        private void DoIssue()
        {
            IssueInfo issue = new IssueInfo();
            issue.ItemId = ((ItemInfo)cboItems.SelectedItem).ItemId;
            issue.QuantityIssued = txtQty.Text.Trim();
            issue.IssueDate = dtpIssue.Text;
            issue.IssuedBy = ((UserInfo)cboUsers.SelectedItem).UserId;
            issue.IssuedTo = txtIssuedTo.Text.Trim();

            try
            {
                IssueMapper.GetInstance().AddIssue(issue);

                ItemInfo item = (ItemInfo)cboItems.SelectedItem;
                item.Issued = (Convert.ToInt32(item.Issued) + Convert.ToInt32(issue.QuantityIssued)).ToString();
                item.CurrentStock = (Convert.ToInt32(item.CurrentStock) - Convert.ToInt32(issue.QuantityIssued)).ToString();

                ItemMapper.Getinstance().UpdateItem(item);
                MessageBox.Show("Transaction completed successfully");
                this.Close();
            }
            catch (Exception exx)
            {
                MessageBox.Show(exx.Message);
            }
        }
Exemple #2
0
        public IList<IssueInfo> GetAllIssues()
        {
            IList<IssueInfo> issues = new List<IssueInfo>();

            using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction,
                System.Data.CommandType.Text, SQL_SELECT_ALL, null))
            {
                while (rdr.Read())
                {
                    IssueInfo issue = new IssueInfo(rdr.GetString(0),
                        rdr.GetValue(1).GetType().Equals(typeof(DBNull)) ? "" : rdr.GetString(1),
                        rdr.GetValue(2).GetType().Equals(typeof(DBNull)) ? "" : rdr.GetString(2),
                        rdr.GetValue(3).GetType().Equals(typeof(DBNull)) ? "" : rdr.GetString(3),
                        rdr.GetValue(4).GetType().Equals(typeof(DBNull)) ? "" : rdr.GetString(4),
                        rdr.GetValue(5).GetType().Equals(typeof(DBNull)) ? "" : rdr.GetString(5));

                    issues.Add(issue);
                }
            }
            return issues;
        }
Exemple #3
0
        public IssueInfo GetIssue(string issueid)
        {
            IssueInfo issue = null;
            SqlParameter param_issueid = new SqlParameter(PARAM_ISSUEID, issueid);

            using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction,
                System.Data.CommandType.Text, SQL_SELECT_ISSUE, param_issueid))
            {
                while (rdr.Read())
                {
                    issue = new IssueInfo(rdr.GetString(0),
                        rdr.GetValue(1).GetType().Equals(typeof(DBNull)) ? "" : rdr.GetString(1),
                        rdr.GetValue(2).GetType().Equals(typeof(DBNull)) ? "" : rdr.GetString(2),
                        rdr.GetValue(3).GetType().Equals(typeof(DBNull)) ? "" : rdr.GetString(3),
                        rdr.GetValue(4).GetType().Equals(typeof(DBNull)) ? "" : rdr.GetString(4),
                        rdr.GetValue(5).GetType().Equals(typeof(DBNull)) ? "" : rdr.GetString(5));
                }
            }
            return issue;
        }
Exemple #4
0
 public void DeleteIssue(IssueInfo issue)
 {
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, System.Data.CommandType.Text,
         SQL_DELETE_ISSUE, CreateParameters(issue));
 }
Exemple #5
0
        private SqlParameter[] CreateParameters(IssueInfo issue)
        {
            SqlParameter param_issueid = new SqlParameter(PARAM_ISSUEID,issue.IssueId);
            SqlParameter param_itemId = new SqlParameter(PARAM_ITEMID, issue.ItemId);
            SqlParameter param_qissued = new SqlParameter(PARAM_QISSUE, issue.QuantityIssued);
            SqlParameter param_issuedate = new SqlParameter(PARAM_ISSUEDATE, issue.IssueDate);
            SqlParameter param_issuedby = new SqlParameter(PARAM_ISSUEDBY, issue.IssuedBy);
            SqlParameter param_issuedto = new SqlParameter(PARAM_ISSUEDTO, issue.IssuedTo);

            return new SqlParameter[] { param_issueid,param_itemId, param_qissued, param_issuedate, param_issuedby, param_issuedto };
        }