Example #1
0
    private bool SaveData()
    {
        objClsCommon = new clsCommon();
        objPinCode   = new tblPinCode();
        if (objClsCommon.IsRecordExists("tblPinCode", tblPinCode.ColumnNames.AppPinCode, tblPinCode.ColumnNames.AppPinCodeID, txtPINCode.Text, hdnPKID.Value))
        {
            DInfo.ShowMessage(" Pin Code already exits.", Enums.MessageType.Error);
            return(false);
        }
        if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
        {
            objPinCode.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));
        }
        else
        {
            objPinCode.AddNew();
        }
        objPinCode.AppPinCode  = Convert.ToInt32(txtPINCode.Text);
        objPinCode.s_AppCityID = ddlCity.SelectedValue.ToString();
        objPinCode.AppIsActive = chkIsActive.Checked;

        objPinCode.Save();
        iBrandID     = objPinCode.AppPinCodeID;
        objPinCode   = null;
        objClsCommon = null;
        return(true);
    }
Example #2
0
 private void SetValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
     {
         objPinCode = new tblPinCode();
         if (objPinCode.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
         {
             txtPINCode.Text     = objPinCode.AppPinCode.ToString();
             chkIsActive.Checked = objPinCode.AppIsActive;
             tblCity objCity = new tblCity();
             if (objCity.LoadByPrimaryKey(objPinCode.AppCityID))
             {
                 objCommon = new clsCommon();
                 tblState objState = new tblState();
                 if (objState.LoadByPrimaryKey(objCity.AppStateID))
                 {
                     ddlCountry.SelectedValue = objState.s_AppCountryID;
                     objCommon.FillDropDownList(ddlState, "tblState", tblState.ColumnNames.AppState, tblState.ColumnNames.AppStateID, "-- Select State --", tblState.ColumnNames.AppCountryID + "=" + ddlCountry.SelectedValue);
                     ddlState.SelectedValue = objState.s_AppStateID;
                     objCommon.FillDropDownList(ddlCity, "tblCity", tblCity.ColumnNames.AppCity, tblCity.ColumnNames.AppCityID, "-- Select City --", tblCity.ColumnNames.AppStateID + "=" + ddlState.SelectedValue);
                     ddlCity.SelectedValue = objCity.s_AppCityID;
                 }
                 objState  = null;
                 objCommon = null;
             }
             objCity = null;
         }
         objPinCode = null;
     }
 }
Example #3
0
    private bool Delete(int intPKID)
    {
        bool retval = false;

        objCity = new tblCity();
        tblPinCode objPINCode = new tblPinCode();

        if (objCity.LoadByPrimaryKey(intPKID))
        {
            objPINCode.Where.AppCityID.Value = intPKID;
            objPINCode.Query.Load();
            if (objPINCode.RowCount > 0)
            {
                retval = false;
            }
            else
            {
                objCity.MarkAsDeleted();
                objCity.Save();
                retval = true;
            }
        }
        objPINCode = null;
        objCity    = null;
        return(retval);
    }
Example #4
0
    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 == "IsActive")
            {
                objPinCode = new tblPinCode();

                if (objPinCode.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
                {
                    if (objPinCode.s_AppIsActive != "")
                    {
                        if (objPinCode.AppIsActive == true)
                        {
                            objPinCode.AppIsActive = false;
                        }
                        else if (objPinCode.AppIsActive == false)
                        {
                            objPinCode.AppIsActive = true;
                        }
                    }
                    else
                    {
                        objPinCode.AppIsActive = true;
                    }
                    objPinCode.Save();
                    LoadDataGrid(false, false);
                }
                objPinCode = null;
            }
        }
    }
Example #5
0
    void getAllDetail(DataTable objDt)
    {
        string strmessage = "";
        string strXML     = new XElement("Countries",
                                         from empList in objDt.AsEnumerable()
                                         select new XElement("Country",
                                                             new XElement("PINCODE", empList.Field <double>("PINCODE")),
                                                             new XElement("ControlingStation", empList.Field <string>("Controling Station")),
                                                             new XElement("LocationCode", empList.Field <string>("Location Code")),
                                                             new XElement("DefaultCity", empList.Field <string>("Default City")),
                                                             new XElement("CITYNAME", empList.Field <string>("CITY NAME")),
                                                             new XElement("STATE_UNIONTERRITORY", empList.Field <string>("STATE/UNION TERRITORY")),
                                                             new XElement("Zone", empList.Field <string>("Zone")),
                                                             new XElement("Region", empList.Field <string>("Region")),
                                                             new XElement("EXP", empList.Field <string>("EXP")),
                                                             new XElement("ToPay", empList.Field <string>("To Pay")),
                                                             new XElement("COD", empList.Field <string>("COD"))
                                                             )).ToString();

        objPinCode = new tblPinCode();
        strmessage = objPinCode.InsertCountriesXMLData(strXML);
        if (strmessage != "")
        {
            DInfo.ShowMessage(strmessage, Enums.MessageType.Successfull);
        }
        else
        {
            DInfo.ShowMessage("Data Not Save..", Enums.MessageType.Warning);
        }
        objPinCode = null;
    }
Example #6
0
    private bool Delete(int intPKID)
    {
        bool retval = false;

        objPinCode = new tblPinCode();
        if (objPinCode.LoadByPrimaryKey(intPKID))
        {
            objPinCode.MarkAsDeleted();
            objPinCode.Save();
            retval = true;
        }
        objPinCode = null;
        return(retval);
    }
Example #7
0
    private void LoadDataGrid(bool IsResetPageIndex, bool IsSort)
    {
        objPinCode = new tblPinCode();

        objDataTable = objPinCode.LoadGridData(txtSearch.Text.Trim(), ddlCountry.SelectedValue.ToString(), ddlState.SelectedValue.ToString(), ddlCity.SelectedValue.ToString());

        //'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();
        }

        objPinCode = null;
    }