Example #1
0
        protected void GvData_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                DataSet     dtInfo = new DataSet();
                GridViewRow gvrow  = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                hdUniqueId.Value = GvData.DataKeys[gvrow.RowIndex].Value.ToString();
                // fill the Location information for edit
                if (e.CommandName == "EditEntry")
                {
                    int StatusVal = 0;
                    objValidateData.ClearAllInputField(pnlDataEntry);
                    dtInfo = objLtmsService.GetPrizeDtlById(Convert.ToInt64(hdUniqueId.Value));
                    if (dtInfo.Tables[0].Rows.Count > 0)
                    {
                        txtUnSoldPercentage.Text    = dtInfo.Tables[0].Rows[0]["UnSoldPercentage"].ToString();
                        txtGovermentOrder.Text      = dtInfo.Tables[0].Rows[0]["GovermentOrder"].ToString();
                        txtLotteryType.Text         = dtInfo.Tables[0].Rows[0]["LotteryType"].ToString();
                        txtLotteryName.Text         = dtInfo.Tables[0].Rows[0]["LotteryName"].ToString();
                        txtClaimDays.Text           = dtInfo.Tables[0].Rows[0]["ClaimDays"].ToString();
                        chkIncludeConsPrize.Checked = Convert.ToBoolean(dtInfo.Tables[0].Rows[0]["IncludeConsPrize"]);
                        StatusVal = Convert.ToInt16(dtInfo.Tables[0].Rows[0]["SaveStatus"].ToString());
                    }
                    if (dtInfo.Tables[1].Rows.Count > 0)
                    {
                        gvPrizeDetails.DataSource = dtInfo.Tables[1];
                        gvPrizeDetails.DataBind();
                    }
                    dtInfo.Dispose();
                    btnSave.Visible    = true;
                    btnConfirm.Visible = true;
                    if (StatusVal >= 7)
                    {
                        btnSave.Visible    = false;
                        btnConfirm.Visible = false;
                    }

                    pnlDataEntry.Visible   = true;
                    pnlDataDisplay.Visible = false;
                }
                dtInfo.Dispose();
            }
            catch (Exception Ex)
            {
                objValidateData.SaveSystemErrorLog(Ex, Request.UserHostAddress);
                var message = new JavaScriptSerializer().Serialize("Some Error has occurred while performing your activity. Please contact the System Administrator for further assistance.");
                var script  = string.Format("alert({0});", message);
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "", script, true);
            }
        }
Example #2
0
        protected void GvData_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                DataSet     dtInfo = new DataSet();
                GridViewRow gvrow  = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                hdUniqueId.Value = GvData.DataKeys[gvrow.RowIndex].Value.ToString();
                // fill the Location information for edit
                if (e.CommandName == "EditEntry")
                {
                    hdIsUpdate.Value = "";

                    objValidateData.ClearAllInputField(pnlDataEntry);
                    int PrizeCategoryCnt = 0;
                    int Status           = 0;
                    dtInfo             = objLtmsService.GetPrizeDtlById(Convert.ToInt64(hdUniqueId.Value));
                    btnSave.Visible    = false;
                    btnConfirm.Visible = false;
                    if (dtInfo.Tables[0].Rows.Count > 0)
                    {
                        txtUnSoldPercentage.Text    = dtInfo.Tables[0].Rows[0]["UnSoldPercentage"].ToString();
                        txtGovermentOrder.Text      = dtInfo.Tables[0].Rows[0]["GovermentOrder"].ToString();
                        txtLotteryType.Text         = dtInfo.Tables[0].Rows[0]["LotteryType"].ToString();
                        txtLotteryName.Text         = !string.IsNullOrWhiteSpace(dtInfo.Tables[0].Rows[0]["ModifiedLotteryName"].ToString()) ? dtInfo.Tables[0].Rows[0]["ModifiedLotteryName"].ToString() : dtInfo.Tables[0].Rows[0]["LotteryName"].ToString();
                        txtClaimDays.Text           = dtInfo.Tables[0].Rows[0]["ClaimDays"].ToString();
                        PrizeCategoryCnt            = Convert.ToInt16(dtInfo.Tables[0].Rows[0]["PrizeCategory"].ToString());
                        chkIncludeConsPrize.Checked = Convert.ToBoolean(dtInfo.Tables[0].Rows[0]["IncludeConsPrize"]);
                        Status = Convert.ToInt16(dtInfo.Tables[0].Rows[0]["SaveStatus"].ToString());
                        if (Status <= 0)
                        {
                            btnSave.Visible = true;
                        }
                        else if (Status >= 1 && Status < 2)
                        {
                            btnSave.Visible    = true;
                            btnConfirm.Visible = true;
                        }
                        else if (Status == 4 || Status == 6 || Status == 8)
                        {
                            btnSave.Visible    = true;
                            btnConfirm.Visible = true;
                        }
                    }
                    if (dtInfo.Tables[1].Rows.Count > 0)
                    {
                        // btnSave.Text = "Update";
                        hdIsUpdate.Value          = hdUniqueId.Value;
                        gvPrizeDetails.DataSource = dtInfo.Tables[1];
                        gvPrizeDetails.DataBind();
                    }
                    else
                    {
                        // btnSave.Text = "Save";
                        DataTable dtPrizeDtl = new DataTable();
                        DataRow   dr         = null;

                        dtPrizeDtl.Columns.Add(new DataColumn("RowNo", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("NameOfPrize", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("PrizeAmount", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("AdministrativeChargePercentage", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("AdministrativeCharge", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("GrossPrizeAmount", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("TaxDeductionPercentage", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("DeductionOfIT", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("PayableToWinner", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("SpecialTicketAmount", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("SpecialTicketAdministrativeChargePercentage", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("SpecialTicketAdministrativeCharge", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("SpecialTicketGrossPrizeAmount", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("SpecialTicketTaxDeductionPercentage", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("SpecialTicketDeductionOfIT", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("PayableToSpecialTicketWinner", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("SuperTicketAmount", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("SuperTicketAdministrativeChargePercentage", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("SuperTicketAdministrativeCharge", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("SuperTicketGrossPrizeAmount", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("SuperTicketTaxDeductionPercentage", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("SuperTicketDeductionOfIT", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("PayableToSuperTicketWinner", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("NoOfWinner", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("NoOfDigitInStatic", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("FixedOrVariable", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("ValidationForUnsold", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("Description1", typeof(string)));
                        dtPrizeDtl.Columns.Add(new DataColumn("Description2", typeof(string)));
                        int RowCnt = 0;
                        for (int iCnt = 1; iCnt <= PrizeCategoryCnt; iCnt++)
                        {
                            RowCnt++;
                            if (chkIncludeConsPrize.Checked == true && iCnt == 2)
                            {
                                dr                = dtPrizeDtl.NewRow();
                                dr["RowNo"]       = RowCnt;
                                dr["NameOfPrize"] = "Cons. Prize";
                                dr["PrizeAmount"] = "0";
                                dr["AdministrativeChargePercentage"] = "0";
                                dr["AdministrativeChargePercentage"] = "0";
                                dr["AdministrativeCharge"]           = "0";
                                dr["GrossPrizeAmount"]       = "0";
                                dr["TaxDeductionPercentage"] = "0";
                                dr["DeductionOfIT"]          = "0";
                                dr["PayableToWinner"]        = "0";
                                dr["SpecialTicketAmount"]    = "0";
                                dr["SpecialTicketAdministrativeChargePercentage"] = "0";
                                dr["SpecialTicketAdministrativeCharge"]           = "0";
                                dr["SpecialTicketGrossPrizeAmount"]       = "0";
                                dr["SpecialTicketTaxDeductionPercentage"] = "0";
                                dr["SpecialTicketDeductionOfIT"]          = "0";
                                dr["PayableToSpecialTicketWinner"]        = "0";
                                dr["SuperTicketAmount"] = "0";
                                dr["SuperTicketAdministrativeChargePercentage"] = "0";
                                dr["SuperTicketAdministrativeCharge"]           = "0";
                                dr["SuperTicketGrossPrizeAmount"]       = "0";
                                dr["SuperTicketTaxDeductionPercentage"] = "0";
                                dr["SuperTicketDeductionOfIT"]          = "0";
                                dr["PayableToSuperTicketWinner"]        = "0";
                                dr["NoOfWinner"]          = string.Empty;
                                dr["NoOfDigitInStatic"]   = string.Empty;
                                dr["FixedOrVariable"]     = string.Empty;
                                dr["ValidationForUnsold"] = string.Empty;
                                dr["Description1"]        = string.Empty;
                                dr["Description2"]        = string.Empty;
                                dtPrizeDtl.Rows.Add(dr);
                                RowCnt++;
                            }
                            dr                = dtPrizeDtl.NewRow();
                            dr["RowNo"]       = RowCnt;
                            dr["NameOfPrize"] = objValidateData.ToOrdinal(iCnt) + " Prize";
                            dr["PrizeAmount"] = "0";
                            dr["AdministrativeChargePercentage"] = "0";
                            dr["AdministrativeChargePercentage"] = "0";
                            dr["AdministrativeCharge"]           = "0";
                            dr["GrossPrizeAmount"]       = "0";
                            dr["TaxDeductionPercentage"] = "0";
                            dr["DeductionOfIT"]          = "0";
                            dr["PayableToWinner"]        = "0";
                            dr["SpecialTicketAmount"]    = "0";
                            dr["SpecialTicketAdministrativeChargePercentage"] = "0";
                            dr["SpecialTicketAdministrativeCharge"]           = "0";
                            dr["SpecialTicketGrossPrizeAmount"]       = "0";
                            dr["SpecialTicketTaxDeductionPercentage"] = "0";
                            dr["SpecialTicketDeductionOfIT"]          = "0";
                            dr["PayableToSpecialTicketWinner"]        = "0";
                            dr["SuperTicketAmount"] = "0";
                            dr["SuperTicketAdministrativeChargePercentage"] = "0";
                            dr["SuperTicketAdministrativeCharge"]           = "0";
                            dr["SuperTicketGrossPrizeAmount"]       = "0";
                            dr["SuperTicketTaxDeductionPercentage"] = "0";
                            dr["SuperTicketDeductionOfIT"]          = "0";
                            dr["PayableToSuperTicketWinner"]        = "0";
                            dr["NoOfWinner"]          = string.Empty;
                            dr["NoOfDigitInStatic"]   = string.Empty;
                            dr["FixedOrVariable"]     = string.Empty;
                            dr["ValidationForUnsold"] = string.Empty;
                            dr["Description1"]        = string.Empty;
                            dr["Description2"]        = string.Empty;
                            dtPrizeDtl.Rows.Add(dr);
                        }
                        gvPrizeDetails.DataSource = dtPrizeDtl;
                        gvPrizeDetails.DataBind();
                    }
                    dtInfo.Dispose();
                    pnlDataEntry.Visible   = true;
                    pnlDataDisplay.Visible = false;
                    // btnSave.Text = "Update";
                }
                dtInfo.Dispose();
            }
            catch (Exception Ex)
            {
                objValidateData.SaveSystemErrorLog(Ex, Request.UserHostAddress);
                var message = new JavaScriptSerializer().Serialize("Some Error has occurred while performing your activity. Please contact the System Administrator for further assistance.");
                var script  = string.Format("alert({0});", message);
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "", script, true);
            }
        }