protected void ImageButtonManageMinus_Click(object sender, ImageClickEventArgs e) { ImageButtonManageCreditEdit.Visible = true; ImageButtonManagePlus.Visible = false; ImageButtonManageMinus.Visible = false; ImageButtonManageCancel.Visible = false; TextBoxManageCredit.Visible = false; //add credit CreditAdd ca = new CreditAdd(); ca.addCredit(Convert.ToInt32(TextBoxManageUserId.Text), 5, Convert.ToInt32("-" + TextBoxManageCredit.Text), Convert.ToInt32(Session["UserId"]), " "); LabelManageActiveCredit.Text = (Convert.ToInt32(LabelManageActiveCredit.Text) - Convert.ToInt32(TextBoxManageCredit.Text)).ToString(); }
protected void RepeaterRequests_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.CompareTo("RequestReject") == 0) { TextBox text = e.Item.FindControl("TextBoxRequestText") as TextBox; //reject CreditRequestAction cra = new CreditRequestAction(); cra.requestAction(Convert.ToInt32(e.CommandArgument.ToString()), 2, text.Text); RepeaterRequests.DataBind(); } if (e.CommandName.CompareTo("RequestVerify") == 0) { TextBox text = e.Item.FindControl("TextBoxRequestText") as TextBox; TextBox credit = e.Item.FindControl("TextBoxRequestVerifiedCredit") as TextBox; Label userid = e.Item.FindControl("LabelRequstUserId") as Label; Label type = e.Item.FindControl("LabelRequestType") as Label; int typeCode = 0; if (type.Text == "1") { typeCode = 3; } else { typeCode = 4; } //verify CreditRequestAction cra = new CreditRequestAction(); cra.requestAction(Convert.ToInt32(e.CommandArgument.ToString()), 1, text.Text); RepeaterRequests.DataBind(); //add credit CreditAdd ca = new CreditAdd(); ca.addCredit(Convert.ToInt32(userid.Text), typeCode, Convert.ToInt32(credit.Text), Convert.ToInt32(Session["UserId"]), text.Text); } }
public int changeStatus(int Status, Int64 RefId) { int UserId = 0; int Credit = 0; int RecordId = 0; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_creditOnlineChangeStatus", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@Status", SqlDbType.Int).Value = Status; sda.SelectCommand.Parameters.Add("@RefId", SqlDbType.Int).Value = RefId; sda.Fill(ds); dt = ds.Tables[0]; if (dt.Rows.Count == 0) //news doesn't exist { //LabelName.Text = "موسسه ای با این شناسه موجود نمی باشد!"; } else //news exists { UserId = Convert.ToInt32(dt.Rows[0]["UserId"].ToString()); Credit = Convert.ToInt32(dt.Rows[0]["Credit"].ToString()); RecordId = Convert.ToInt32(dt.Rows[0]["RecordId"].ToString()); } sda.Dispose(); sqlConn.Close(); if (Status == 0) { CreditAdd ca = new CreditAdd(); ca.addCredit(UserId, 1, Credit, 0, RecordId.ToString()); } return(RecordId); }
public int changeStatus(int Status, Int64 RefId) { int UserId = 0; int Credit = 0; int RecordId = 0; DataTable dt = new DataTable(); DataSet ds = new DataSet(); SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString); SqlDataAdapter sda = new SqlDataAdapter("sp_creditOnlineChangeStatus", sqlConn); sda.SelectCommand.CommandType = CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add("@Status", SqlDbType.Int).Value = Status; sda.SelectCommand.Parameters.Add("@RefId", SqlDbType.Int).Value = RefId; sda.Fill(ds); dt = ds.Tables[0]; if (dt.Rows.Count == 0) //news doesn't exist { //LabelName.Text = "موسسه ای با این شناسه موجود نمی باشد!"; } else //news exists { UserId = Convert.ToInt32(dt.Rows[0]["UserId"].ToString()); Credit = Convert.ToInt32(dt.Rows[0]["Credit"].ToString()); RecordId = Convert.ToInt32(dt.Rows[0]["RecordId"].ToString()); } sda.Dispose(); sqlConn.Close(); if (Status == 0) { CreditAdd ca = new CreditAdd(); ca.addCredit(UserId, 1, Credit, 0, RecordId.ToString()); } return RecordId; }