protected void LinkButtonStatsRefresh_Click(object sender, EventArgs e) { StatsRefresh sr = new StatsRefresh(); sr.refreshStats("Users"); ImageStatsRefresh.ImageUrl = "~/images/icons/check16.png"; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_statsUsers", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.Fill(ds); dt = ds.Tables[0]; TimeClass tc = new TimeClass(); LabelStatsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["UsersDate"].ToString())); LabelStatsUsers.Text = dt.Rows[0]["UsersCount"].ToString(); LabelStatsGenderFemale.Text = "زن: " + dt.Rows[0]["UsersGenderFemale"].ToString(); LabelStatsGenderMale.Text = " مرد: " + dt.Rows[0]["UsersGenderMale"].ToString(); LabelStatsLogin.Text = dt.Rows[0]["UsersLoginMonth"].ToString(); sda.Dispose(); sqlConn.Close(); }
protected void LinkButtonCouponsRefresh_Click(object sender, EventArgs e) { StatsRefresh sr = new StatsRefresh(); sr.refreshStats("Coupons"); ImageCouponsRefresh.ImageUrl = "~/images/icons/check16.png"; }
protected void LinkButtonStatsRefresh_Click(object sender, EventArgs e) { StatsRefresh sr = new StatsRefresh(); sr.refreshStats("Credit"); ImageStatsRefresh.ImageUrl = "~/images/icons/check16.png"; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_statsCredit", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.Fill(ds); dt = ds.Tables[0]; PanelManageUser.Visible = true; LabelMessage.Visible = false; TimeClass tc = new TimeClass(); LabelStatsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["CreditDate"].ToString())); LabelStatsActiveCredit.Text = dt.Rows[0]["CreditSum"].ToString(); LabelStatsGiftCredit.Text = dt.Rows[0]["CreditGiftCredit"].ToString(); LabelStatsSpentCredit.Text = dt.Rows[0]["CreditSpent"].ToString(); LabelStatsSpentGift.Text = dt.Rows[0]["CreditGiftSpent"].ToString(); LabelStatsActiveCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditSum"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString(); LabelStatsGiftCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditGiftCredit"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString(); LabelStatsSpentCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditSpent"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString(); LabelStatsSpentGiftAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditGiftSpent"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString(); sda.Dispose(); sqlConn.Close(); }