private bool SaveData() { objCommon = new clsCommon(); if (objCommon.IsRecordExists("tblCourierCompany", tblCourierCompany.ColumnNames.AppCourierCompany, tblCourierCompany.ColumnNames.AppCourierCompanyID, txtCourierCompanyName.Text, hdnPKID.Value)) { DInfo.ShowMessage("Courier Company Name alredy exits.", Enums.MessageType.Error); return(false); } objCourierCompany = new tblCourierCompany(); if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objCourierCompany.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)); } else { objCourierCompany.AddNew(); objCourierCompany.AppDisplayOrder = objCommon.GetNextDisplayOrder("tblCourierCompany", tblCourierCompany.ColumnNames.AppDisplayOrder); } objCourierCompany.AppCourierCompany = txtCourierCompanyName.Text; objCourierCompany.s_AppCODRate = txtCODRate.Text; objCourierCompany.AppEmail = txtEmail.Text; objCourierCompany.AppContactNo = txtContactNo.Text; objCourierCompany.AppWebsite = txtWebsite.Text; objCourierCompany.AppIsActive = chkIsActive.Checked; objCourierCompany.Save(); iCourierCompanyID = objCourierCompany.AppCourierCompanyID; objCourierCompany = null; objCommon = null; return(true); }
protected void dgvSubDetail_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { if (!string.IsNullOrEmpty(e.CommandArgument.ToString())) { if (e.CommandName == "IsView") { tblReturnOrder objReturnOrder = new tblReturnOrder(); if (objReturnOrder.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()))) { if (objReturnOrder.s_AppCourierCompanyID == "" || objReturnOrder.AppCourierCompanyID == null) { lblForLabel1.Text = "Contact No."; lblValue1.Text = objReturnOrder.AppCourierCompanyContactNo; lblForLabel2.Text = "Site URL."; lblValue2.Text = objReturnOrder.AppCourierCompanyWebsite; } else { lblForLabel1.Text = "Courier Company"; tblCourierCompany objCourierCompany = new tblCourierCompany(); if (objCourierCompany.LoadByPrimaryKey(objReturnOrder.AppCourierCompanyID)) { lblValue1.Text = objCourierCompany.AppCourierCompany; } objCourierCompany = null; lblForLabel2.Text = "Docket No"; lblValue2.Text = objReturnOrder.AppDocketNo; } mpeView.Show(); } } } }
protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { if (!string.IsNullOrEmpty(e.CommandArgument.ToString())) { objCommon = new clsCommon(); hdnPKID.Value = e.CommandArgument.ToString(); if (e.CommandName == "Up") { LinkButton inkButton = (LinkButton)e.CommandSource; GridViewRow drCurrent = (GridViewRow)inkButton.Parent.Parent; if (drCurrent.RowIndex > 0) { GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex - 1]; objCommon.SetDisplayOrder("tblCourierCompany", tblCourierCompany.ColumnNames.AppCourierCompanyID, tblCourierCompany.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[2], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[2]); LoadDataGrid(false, false); objCommon = null; } } else if (e.CommandName == "Down") { LinkButton lnkButton = (LinkButton)e.CommandSource; GridViewRow drCurrent = (GridViewRow)lnkButton.Parent.Parent; if (drCurrent.RowIndex < dgvGridView.Rows.Count - 1) { GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex + 1]; objCommon.SetDisplayOrder("tblCourierCompany", tblCourierCompany.ColumnNames.AppCourierCompanyID, tblCourierCompany.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[2], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[2]); LoadDataGrid(false, false); objCommon = null; } } else if (e.CommandName == "IsActive") { objCourierCompany = new tblCourierCompany(); if (objCourierCompany.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value))) { if (objCourierCompany.AppIsActive == true) { objCourierCompany.AppIsActive = false; } else if (objCourierCompany.AppIsActive == false) { objCourierCompany.AppIsActive = true; } objCourierCompany.Save(); LoadDataGrid(false, false, "", ""); } objCourierCompany = null; } } }
private void LoadDataGrid(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "") { objCourierCompany = new tblCourierCompany(); objDataTable = objCourierCompany.LoadGridData(ddlFields.SelectedValue, txtSearch.Text.Trim()); //'Reset PageIndex of gridviews if (IsResetPageIndex) { if (dgvGridView.PageCount > 0) { dgvGridView.PageIndex = 0; } } dgvGridView.DataSource = null; dgvGridView.DataBind(); lblCount.Text = 0.ToString(); hdnSelectedIDs.Value = ""; //'Check for data into datatable if (objDataTable.Rows.Count <= 0) { DInfo.ShowMessage("No data found", Enums.MessageType.Information); return; } else { if (ddlPerPage.SelectedItem.Text.ToLower() == "all") { dgvGridView.AllowPaging = false; } else { dgvGridView.AllowPaging = true; dgvGridView.PageSize = Convert.ToInt32(ddlPerPage.SelectedItem.Text); } lblCount.Text = objDataTable.Rows.Count.ToString(); objDataTable = SortDatatable(objDataTable, ViewState["SortColumn"].ToString(), (appFunctions.Enum_SortOrderBy)ViewState["SortOrder"], IsSort); dgvGridView.DataSource = objDataTable; dgvGridView.DataBind(); } objCourierCompany = null; }
private void SetValuesToControls() { if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objCourierCompany = new tblCourierCompany(); if (objCourierCompany.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value))) { txtCourierCompanyName.Text = objCourierCompany.AppCourierCompany; txtCODRate.Text = objCourierCompany.s_AppCODRate; txtEmail.Text = objCourierCompany.AppEmail; txtContactNo.Text = objCourierCompany.AppContactNo; txtWebsite.Text = objCourierCompany.AppWebsite; chkIsActive.Checked = objCourierCompany.AppIsActive; } objCourierCompany = null; } }
private bool Delete(int intPKID) { bool retval = false; objCourierCompany = new tblCourierCompany(); var _with1 = objCourierCompany; if (_with1.LoadByPrimaryKey(intPKID)) { _with1.MarkAsDeleted(); _with1.Save(); } retval = true; objCourierCompany = null; return(retval); }