/* Company */
        public void UpdateCompanyData()
        {
            SqlConnection conn   = new SqlConnection(dbconn.Configuration());
            SqlCommand    cmd    = null;
            SqlDataReader rdr    = null;
            string        sqlsel = "select * from company";

            try
            {
                conn.Open();
                cmd = new SqlCommand(sqlsel, conn);
                rdr = cmd.ExecuteReader();

                GridViewCompany.DataSource = rdr;
                GridViewCompany.DataBind();
            }
            catch (Exception ex)
            {
                LabelCompanyMessage.Text = ex.Message;
            }
            finally
            {
                conn.Close();
            }
        }
Beispiel #2
0
        private void executeQuery()
        {
            this.Cursor = Cursors.WaitCursor;
            string colName = GridViewCompany.FocusedColumn.FieldName;
            string value   = String.Empty;

            if (!string.IsNullOrWhiteSpace(GridViewCompany.GetFocusedDisplayText()))
            {
                value = GridViewCompany.GetFocusedDisplayText();
            }
            if (!string.IsNullOrWhiteSpace(value))
            {
                string query   = String.Format("it.NAME like '{0}%'", GridViewCompany.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "NAME"));
                var    special = context.COMPANY.Where(query);

                if (!string.IsNullOrWhiteSpace(GridViewCompany.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "CODE")))
                {
                    query   = String.Format("it.{0} like '{1}%'", "CODE", GridViewCompany.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "CODE"));
                    special = special.Where(query);
                }

                int count = special.Count();
                if (count > 0)
                {
                    CompanyBindingSource.DataSource = special;
                    GridViewCompany.ClearColumnsFilter();
                }
                else
                {
                    MessageBox.Show("No records in database.");
                    GridViewCompany.ClearColumnsFilter();
                }
            }
            this.Cursor = Cursors.Default;
        }
Beispiel #3
0
        public void UpdateGridViewCompany()
        {
            SqlConnection conn   = new SqlConnection(dbconfig);
            SqlCommand    cmd    = null;
            SqlDataReader rdr    = null;
            string        sqlsel = "SELECT IdCompany, Name, Logo, Website FROM Company";

            try
            {
                conn.Open();
                cmd = new SqlCommand(sqlsel, conn);
                rdr = cmd.ExecuteReader();

                GridViewCompany.DataSource = rdr;
                GridViewCompany.DataBind();
            }
            catch (Exception ex)
            {
                LabelMessageCompany.Text = ex.Message;
            }
            finally
            {
                conn.Close();
            }
        }
Beispiel #4
0
 private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     if (!GridViewCompany.IsFilterRow(e.RowHandle))
     {
         modified = true;
     }
 }
Beispiel #5
0
 private void CompanyForm_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter && GridViewCompany.IsFilterRow(GridViewCompany.FocusedRowHandle))
     {
         executeQuery();
     }
 }
Beispiel #6
0
        private void cOMPANYBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (CompanyBindingSource.Current == null)
            {
                return;
            }
            GridViewCompany.CloseEditor();
            cODETextEdit.Focus();

            bool temp = newRec;

            //bindingNavigatorPositionItem.Focus();//trigger field leave event
            if (checkForms())
            {
                cODETextEdit.Focus();
                cODETextEdit.Properties.ReadOnly = true;
                GridViewCompany.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = false;
                panelControlStatus.Visible = true;
                LabelStatus.Text           = "Record Saved";
                rowStatusSave          = new Timer();
                rowStatusSave.Interval = 3000;
                rowStatusSave.Start();
                rowStatusSave.Tick += TimedEventSave;
            }

            if (!temp && !modified)
            {
                context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (COMPANY)CompanyBindingSource.Current);
            }
        }
Beispiel #7
0
 private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
 {
     if (CompanyBindingSource.Current == null)
     {
         return;
     }
     GridViewCompany.CloseEditor();
     if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         modified = false;
         newRec   = false;
         CompanyBindingSource.RemoveCurrent();
         errorProvider1.Clear();
         context.SaveChanges();
         cODETextEdit.Properties.ReadOnly = true;
         GridViewCompany.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = false;
         panelControlStatus.Visible = true;
         LabelStatus.Text           = "Record Deleted";
         rowStatusDelete            = new Timer();
         rowStatusDelete.Interval   = 3000;
         rowStatusDelete.Start();
         rowStatusDelete.Tick += new EventHandler(TimedEventDelete);
     }
     currentVal = cODETextEdit.Text;
 }
        private void BindGridView(string search)
        {
            User         LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
            QueryBuilder qb           = new QueryBuilder();
            string       query        = qb.QueryForCompanyViewLinq(LoggedInUser);

            GridViewCompany.DataBind();
        }
        private void BindGridView(string search)
        {
            User           LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
            QueryBuilder   qb           = new QueryBuilder();
            string         query        = qb.QueryForCompanyViewLinq(LoggedInUser);
            List <Company> _View        = da.Companies.Where(query).OrderBy(s => s.CompName).ToList();

            GridViewCompany.DataSource = _View.Where(aa => aa.CompName.ToUpper().Contains(search.ToUpper())).ToList();
            GridViewCompany.DataBind();
        }
Beispiel #10
0
        private void BindGridView(string search)
        {
            User         LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
            QueryBuilder qb           = new QueryBuilder();
            string       query        = qb.QueryForCompanyViewLinq(LoggedInUser);

            DataTable      dt    = qb.GetValuesfromDB("select * from Company where " + query);
            List <Company> _View = dt.ToList <Company>().AsQueryable().ToList();

            _View = _View.OrderBy(s => s.CompName).ToList();
            GridViewCompany.DataSource = _View.Where(aa => aa.CompName.ToUpper().Contains(search.ToUpper())).ToList();
            GridViewCompany.DataBind();
        }
Beispiel #11
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            GridViewCompany.ClearColumnsFilter();
            if (CompanyBindingSource.Current == null)
            {
                //fake query in order to create a link between the database table and the binding source
                CompanyBindingSource.DataSource = from opt in context.COMPANY where opt.CODE == "KJM9" select opt;
                CompanyBindingSource.AddNew();
                if (GridViewCompany.FocusedRowHandle == GridControl.AutoFilterRowHandle)
                {
                    GridViewCompany.FocusedRowHandle = GridViewCompany.RowCount - 1;
                }
                setValues();
                cODETextEdit.Focus();
                cODETextEdit.Properties.ReadOnly = false;
                GridViewCompany.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = true;
                newRec = true;
                return;
            }

            cODETextEdit.Focus();

            //  bindingNavigatorPositionItem.Focus();  //trigger field leave event
            GridViewCompany.CloseEditor();
            temp = newRec;
            if (checkForms())
            {
                if (!temp)
                {
                    context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, ( COMPANY)CompanyBindingSource.Current);
                }
                CompanyBindingSource.AddNew();
                if (GridViewCompany.FocusedRowHandle == GridControl.AutoFilterRowHandle)
                {
                    GridViewCompany.FocusedRowHandle = GridViewCompany.RowCount - 1;
                }
                setValues();
                cODETextEdit.Focus();
                cODETextEdit.Properties.ReadOnly = false;
                GridViewCompany.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = true;
                newRec = true;
            }
        }
    public void BindCompany()
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        int comID = UDFLib.ConvertToInteger(Session["USERCOMPANYID"]);

        string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
        {
            sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
        }

        //DataTable dt = objBLL.SearchCompany_verify(txtfilter.Text != "" ? txtfilter.Text : null, UDFLib.ConvertIntegerToNull(ddlCompanyTypeFilter.SelectedValue), UDFLib.ConvertIntegerToNull(ddlCountryIncorpFilter.SelectedValue)
        //   , UDFLib.ConvertIntegerToNull(ddlCurrencyFilter.SelectedValue), UDFLib.ConvertIntegerToNull(ddlCountryFilter.SelectedValue), comID.ToString(), sortbycoloumn, sortdirection
        // , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref  rowcount);

        DataTable dtAllCHK = objBl.Get_CheckListAll(txtfilter.Text != "" ? txtfilter.Text : null, UDFLib.ConvertIntegerToNull(ddlCheklistFilter.SelectedValue), UDFLib.ConvertIntegerToNull(ddlVesselTypeFilter.SelectedValue), sortbycoloumn, sortdirection
                                                    , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);

        GridViewCompany.DataSource = dtAllCHK;
        GridViewCompany.DataBind();

        ucCustomPagerItems.CountTotalRec = rowcount.ToString();
        ucCustomPagerItems.BuildPager();

        //if (ucCustomPagerItems.isCountRecord == 1)
        //{
        //    ucCustomPagerItems.CountTotalRec = rowcount.ToString();
        //    ucCustomPagerItems.BuildPager();
        //}


        //if (dtAllCHK.Rows.Count > 0)
        //{
        //    GridViewCompany.DataSource = dtAllCHK;
        //    GridViewCompany.DataBind();
        //}
        //else
        //{
        //    GridViewCompany.DataSource = dtAllCHK;
        //    GridViewCompany.DataBind();
        //}
    }
Beispiel #13
0
 private bool move()
 {
     GridViewCompany.CloseEditor();
     //bindingNavigatorPositionItem.Focus();//trigger field leave event
     cODETextEdit.Focus();
     temp = newRec;
     if (checkForms())
     {
         if (!temp)
         {
             context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, ( COMPANY)CompanyBindingSource.Current);
         }
         cODETextEdit.Properties.ReadOnly = true;
         GridViewCompany.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = false;
         newRec   = false;
         modified = false;
         return(true);
     }
     return(false);
 }
Beispiel #14
0
    public void BindVesselGA()
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        int comID = UDFLib.ConvertToInteger(Session["USERCOMPANYID"]);

        string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
        {
            sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
        }


        DataTable dt = objSURVBLL.Get_VesselGASearch(txtfilter.Text != "" ? txtfilter.Text : null, null, UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue), UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), sortbycoloumn, sortdirection
                                                     , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, Session["USERCOMPANYID"].ToString(), ref rowcount);



        if (ucCustomPagerItems.isCountRecord == 1)
        {
            ucCustomPagerItems.CountTotalRec = rowcount.ToString();
            ucCustomPagerItems.BuildPager();
        }


        if (dt.Rows.Count > 0)
        {
            GridViewCompany.DataSource = dt;
            GridViewCompany.DataBind();
        }
        else
        {
            GridViewCompany.DataSource = dt;
            GridViewCompany.DataBind();
        }
    }
Beispiel #15
0
 protected void DetailsViewCompany_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
 {
     GridViewCompany.DataBind();
 }
 protected void LoadCompany()
 {
     GridViewCompany.DataSource = companyManger.GetAllCompany();
     GridViewCompany.DataBind();
 }
Beispiel #17
0
 private void setValues()
 {
     GridViewCompany.SetFocusedRowCellValue("CODE", string.Empty);
     GridViewCompany.SetFocusedRowCellValue("TYPE", string.Empty);
     GridViewCompany.SetFocusedRowCellValue("NAME", string.Empty);
 }