/// <summary>
        /// load dropdownlist 
        /// </summary>
        /// <param name="ddl">System.Web.UI.WebControls.DropDownList ddl</param>
        public static void fillListBoxItems(System.Web.UI.WebControls.ListBox _lst, UnitType _unitype)
        {
            try
            {

                UnitType _c = new UnitType();
                _c = _unitype;
                new UnitTypeSelect(_c).UnitTypeListBox(_c._dropDownList);

                _lst.DataSource = _c._dropDownList;
                _lst.DataTextField = "Name";
                _lst.DataValueField = "Value";
                _lst.DataBind();

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _lst = null;
                _unitype = null;
            }
        }
        /// <summary>
        /// load dropdownlist 
        /// </summary>
        /// <param name="ddl">System.Web.UI.WebControls.DropDownList ddl</param>
        public static void fillDropDownItems(System.Web.UI.WebControls.DropDownList ddl, UnitType _unitype)
        {
            try
            {
                UnitType _c = new UnitType();
                _c = _unitype;
                new UnitTypeSelect(_c).UnitTypeDropDownList(_c._dropDownList);

                ddl.DataSource = _c._dropDownList;
                ddl.DataTextField = "Name";
                ddl.DataValueField = "Value";
                ddl.DataBind();

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ddl = null;
            }
        }
예제 #3
0
 public makeTypeParam(UnitType _unitType)
 {
     this._unitType = _unitType;
         build();
 }
예제 #4
0
    private void loadUnitType(int _comID)
    {
        AlarmasABC.Core.Admin.UnitType _unitType = new AlarmasABC.Core.Admin.UnitType();

        try
        {
            _unitType.ComID = _comID;
            ProcessUnitTypeQueries.fillListBoxItems(_lstNBT, _unitType);

        }
        catch (Exception ex)
        {
            ex.Message.ToString();
        }
    }
예제 #5
0
 public UnitTypeSelect(UnitType _uType)
 {
     this._UnitType = _uType;
     Command = "SELECT typeID,typeName FROM tblUnitType WHERE comID = :comID" +
               " ORDER BY typeName ASC;";
 }
예제 #6
0
    private void LoadUnitType()
    {
        try
        {
            ProcessCompanyUnitTypeQueries _unitType = new ProcessCompanyUnitTypeQueries();

            AlarmasABC.Core.Admin.UnitType _unit= new AlarmasABC.Core.Admin.UnitType();
            _unit.ComID = int.Parse(Session["trkCompany"].ToString());
            _unitType.UnitType = _unit;
            _unitType.invoke();
            DataSet _ds = new DataSet();
            _ds = _unitType.Ds;

            int count = _ds.Tables[0].Rows.Count;
            _rgrdtype.DataSource = _ds;

        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message.ToString());
        }
        finally
        {

        }
    }
예제 #7
0
    private void SaveUnitType()
    {
        AlarmasABC.Core.Admin.UnitType _unitType = new AlarmasABC.Core.Admin.UnitType();

        ProcessUnitTypeNotQueries insert = new ProcessUnitTypeNotQueries(AlarmasABC.BLL.InvokeOperations.operations.INSERT);

        try
        {
            _unitType.TypeName = _txtTypeName.Text;
            string _comID = Session["trkCompany"].ToString();
            _unitType.ComID = int.Parse(_comID);

            insert.UnitType = _unitType;
            insert.invoke();

            clearControls();
            _lblMessage.ForeColor = System.Drawing.Color.Green;
            _lblMessage.Text = "Unit Type created Successfully.";

        }
        catch (Exception ex)
        {
            throw new Exception(" CompanyAdmin::UnitType:: " + ex.Message.ToString());
            _lblMessage.ForeColor = System.Drawing.Color.Red;
            _lblMessage.Text = "Unit Type create fail.";
        }
        finally
        {
            _unitType = null;
        }
    }
예제 #8
0
    protected void _rgrdtype_UpdateCommand(object source, GridCommandEventArgs e)
    {
        GridEditableItem editedItem = e.Item as GridEditableItem;
        string _typeID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["typeID"].ToString();
        string _typeName = (editedItem["typeName"].Controls[0] as TextBox).Text;

        AlarmasABC.Core.Admin.UnitType _unitType = new AlarmasABC.Core.Admin.UnitType();
        ProcessUnitTypeNotQueries _updateType = new ProcessUnitTypeNotQueries(AlarmasABC.BLL.InvokeOperations.operations.UPDATE);

        try
        {
            _unitType.Name = _typeName;
            _unitType.TypeID = int.Parse(_typeID);
            _unitType.ComID = int.Parse(Session["trkCompany"].ToString());

            _updateType.UnitType = _unitType;
            _updateType.invoke();

        }
        catch (Exception ex)
        {
            throw new Exception(" CompanyAdmin::UnitType:: " + ex.Message.ToString());
        }

        finally
        {
            _unitType = null;
            _updateType = null;
        }
        _lblMessage.Text = "Unit Type Updated Successfully.";
        _lblMessage.ForeColor = System.Drawing.Color.Green;
    }
예제 #9
0
    protected void _rgrdtype_DeleteCommand(object source, GridCommandEventArgs e)
    {
        GridEditableItem editedItem = e.Item as GridEditableItem;
        string _typeID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["typeID"].ToString();
        string _tName = ((Label)e.Item.FindControl("lbltypeName")).Text;
        if (!UnitExist(_typeID))
        {
            ProcessUnitTypeNotQueries delete = new ProcessUnitTypeNotQueries(AlarmasABC.BLL.InvokeOperations.operations.DELETE);

            AlarmasABC.Core.Admin.UnitType _unitType = new AlarmasABC.Core.Admin.UnitType();
            try
            {

                _unitType.TypeID = int.Parse(_typeID);

                delete.UnitType = _unitType;
                delete.invoke();

            }
            catch (Exception ex)
            {
                throw new Exception(" :: " + ex.Message);
            }

            finally
            {
                _unitType = null;
            }
        }
        else
        {
            _lblMessage.Text = "Unit category "+_tName+ " in use and can't be deleted";
        }
    }
예제 #10
0
 public UnitTypeInsertParams(UnitType unit)
 {
     this._unitType = unit;
     build();
 }
 private void loadUnitCat(string ComID)
 {
     AlarmasABC.Core.Admin.UnitType _uType = new AlarmasABC.Core.Admin.UnitType();
     _uType.ComID = int.Parse(ComID);
     ProcessUnitTypeQueries.fillDropDownItems(cmbVehicleCat, _uType);
 }
예제 #12
0
    private int createUnitGroup(string name)
    {
        AlarmasABC.Core.Admin.UnitType unitType = new AlarmasABC.Core.Admin.UnitType();

        ProcessUnitTypeNotQueries insert = new ProcessUnitTypeNotQueries(AlarmasABC.BLL.InvokeOperations.operations.INSERT);

        try
        {
            unitType.TypeName = name;
            unitType.ComID = comID;

            insert.UnitType = unitType;
            insert.invoke();

            DataSet _ds = new DataSet();
            ExecuteSQL exec = new ExecuteSQL();
            _ds = exec.getDataSet("SELECT typeID FROM tblUnitType WHERE comID = "
                                  + comID + " AND typeName = '" + name + "';");

            int typeID = int.Parse(_ds.Tables[0].Rows[0][0].ToString());
            if (typeID < 1)
            {
                return -1;
            }

            return typeID;

        }
        catch (Exception ex)
        {
            throw new Exception(" CreateNewAccount::createUnitGroup(): " + ex.Message.ToString());
        }
        finally
        {
            unitType = null;
        }
    }