示例#1
0
        public static int AddBiller(BillerItem itm)
        {
            bool returnValue = false;
            int billerID = 0;
            if (itm != null)
            {
                billerID = getNextBillerID();
                IBaseQueryData query = new InsertQueryData();
                query.TableName = "Biller";
                query.Fields.Add(new FieldData { FieldName = "BillerID", FieldValue = billerID.ToString(), FieldType = SqlDbType.BigInt });
                query.Fields.Add(new FieldData { FieldName = "BillerName", FieldValue = itm.Name, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "AddressLine1", FieldValue = itm.AddressLine1, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "AddressLine2", FieldValue = itm.AddressLine2, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "City", FieldValue = itm.City, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "Zip", FieldValue = itm.Zip, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "State", FieldValue = itm.State, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "Country", FieldValue = itm.Country, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "Notes", FieldValue = itm.Notes, FieldType = SqlDbType.VarChar });

                returnValue = SQLWrapper.ExecuteQuery(query);
            }
            if (returnValue)
            {
                return billerID;
            }
            else
            {
                return 0;
            }
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool returnValue = false;
            if (isValidData(true))
            {
                if (IsPageDirty)
                {
                    BillerItem biller = null;
                    switch (this.CurrentPageMode)
                    {
                        case PageMode.Add:
                            {
                                biller = new BillerItem();
                                break;
                            }
                        case PageMode.Edit:
                            {
                                biller = DALBiller.GetBillerByID(ItemID);
                                break;
                            }
                    }

                    biller.Name = this.txtBillerName.Text;
                    biller.AddressLine1 = this.txtAddressLine1.Text;
                    biller.AddressLine2 = this.txtAddressLine2.Text;
                    biller.City = this.txtCity.Text;
                    biller.Zip = this.txtZip.Text;
                    biller.State = "TN";
                    biller.Country = "India";
                    biller.Notes = this.txtBillerNotes.Text;
                    try
                    {
                        switch (this.CurrentPageMode)
                        {
                            case PageMode.Add:
                                {
                                    returnValue = (DALBiller.AddBiller(biller) > 0);
                                    break;
                                }
                            case PageMode.Edit:
                                {
                                    returnValue = DALBiller.UpdateBiller(biller);
                                    break;
                                }
                        }
                    }
                    catch (Exception ex)
                    {
                        ShowError("Unable to save biller information. Please review the error message below and fix the data accordingly" + Environment.NewLine + ex.Message, Form_Title);
                    }
                    biller = null;
                }
                if (returnValue)
                {
                    this.Hide();
                    this.Close();
                }
            }
        }
示例#3
0
        public static bool UpdateBiller(BillerItem itm)
        {
            bool returnValue = false;
            if (itm != null)
            {
                IBaseQueryData query = new UpdateQueryData();
                query.TableName = "Biller";
                query.KeyFields.Add(new FieldData { FieldName = "BillerID", FieldValue = itm.ID.ToString(), FieldType = SqlDbType.BigInt });
                query.Fields.Add(new FieldData { FieldName = "BillerName", FieldValue = itm.Name, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "AddressLine1", FieldValue = itm.AddressLine1, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "AddressLine2", FieldValue = itm.AddressLine2, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "City", FieldValue = itm.City, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "Zip", FieldValue = itm.Zip, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "State", FieldValue = itm.State, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "Country", FieldValue = itm.Country, FieldType = SqlDbType.VarChar });
                query.Fields.Add(new FieldData { FieldName = "Notes", FieldValue = itm.Notes, FieldType = SqlDbType.VarChar });

                returnValue = SQLWrapper.ExecuteQuery(query);

            }
            return returnValue;
        }
示例#4
0
 private void loadBillers(BillerItem biller)
 {
     this.cboBillers.DataSource = DALBiller.GetBillers();
     this.cboBillers.ValueMember = "ID";
     this.cboBillers.DisplayMember = "Name";
     if (biller != null)
     {
         for (int i = 0; i <= this.cboBillers.Items.Count - 1; i++)
         {
             BillerItem tmp = (BillerItem)this.cboBillers.Items[i];
             if (biller.ID == tmp.ID)
             {
                 this.cboBillers.SelectedItem = tmp;
                 break;
             }
         }
     }
 }
示例#5
0
 private static BillerItem loadBiller(DataTable dt, int rowNo)
 {
     BillerItem biller = null;
     if (dt != null)
     {
         if (dt.Rows.Count > rowNo)
         {
             biller = new BillerItem();
             biller.ID = (Int32)dt.Rows[rowNo]["BillerID"];
             biller.Name = dt.Rows[rowNo]["BillerName"].ToString();
             biller.AddressLine1 = dt.Rows[rowNo]["AddressLine1"].ToString();
             biller.AddressLine2 = dt.Rows[rowNo]["AddressLine2"].ToString();
             biller.City = dt.Rows[rowNo]["City"].ToString();
             biller.Zip = dt.Rows[rowNo]["Zip"].ToString();
             biller.State = dt.Rows[rowNo]["State"].ToString();
             biller.Country = dt.Rows[rowNo]["Country"].ToString();
             biller.Notes = dt.Rows[rowNo]["Notes"].ToString();
         }
     }
     return biller;
 }