Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                txtMsg.Text = "";
                if (lblIsEdit.Text == "1")
                {
                    string password  = DialogConfirm.ShowDialog("Please provide password to continue.", "Confirm with Password");
                    string finalPass = SecurityEncrypt.Decrypt(ConfigurationManager.AppSettings["ActionConfirmPassword"].ToString(), "nakshal");

                    if (password == finalPass)
                    {
                        Save();
                    }
                    else if (password == "")
                    {
                        MessageBox.Show("Save has been canceled by user.");
                    }
                    else
                    {
                        MessageBox.Show("Wrong Password.");
                    }
                }
                else
                {
                    Save();
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
Ejemplo n.º 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                txtMsg.Text = "";
                string password  = DialogConfirm.ShowDialog("Please provide password to continue.", "Confirm with Password");
                string finalPass = SecurityEncrypt.Decrypt(ConfigurationManager.AppSettings["ActionConfirmPassword"].ToString(), "nakshal");

                if (password == finalPass)
                {
                    List <SqlParameter> sqlParams = new List <SqlParameter>();
                    sqlParams.Add(new SqlParameter {
                        ParameterName = "@userId", SqlDbType = SqlDbType.VarChar, Value = User.LoginId
                    });
                    sqlParams.Add(new SqlParameter {
                        ParameterName = "@rationCardId", SqlDbType = SqlDbType.VarChar, Value = lblRationCardId.Text
                    });
                    sqlParams.Add(new SqlParameter {
                        ParameterName = "@customerId", SqlDbType = SqlDbType.VarChar, Value = lblCustId.Text
                    });
                    DataSet ds = ConnectionManager.Exec("Sp_RationCard_Delete", sqlParams);
                    if ((ds != null) && (ds.Tables.Count > 0) && (ds.Tables[0].Rows.Count > 0))
                    {
                        txtMsg.Text = ds.Tables[0].Rows[0][1].ToString();
                        RefreshCatWiseCount();
                        ResetForm();
                        FetchFormData();
                    }
                }
                else if (password == "")
                {
                    MessageBox.Show("Delete has been canceled by user.");
                }
                else
                {
                    MessageBox.Show("Wrong Password.");
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }