//public void UpItem(object sender, EventArgs e) //{ // String AgreementFineID = ((HtmlAnchor)sender).HRef.ToString(); // LblParamAgreementFineID.Text = AgreementFineID; // ClAgreeStatus cl = new ClAgreeStatus(); // cl.AgreementFineID = Convert.ToInt32(AgreementFineID); // Data = cl; // LightBox.Value = "1"; //} protected void BtnInsert_Click(Object sender, System.EventArgs e) { ClAgreeStatus cl = new ClAgreeStatus(); cl = Data; int t = 0; if (CSharp.PublicFunction.ModeInsert(LblParamAgreeStatus.Text)) { t = AgreeStatusClass.insert(cl); } else { t = AgreeStatusClass.Update(cl); } if (t == 0) { LblMsg.ForeColor = System.Drawing.Color.Red; LblMsg.Text = "خطا در ثبت"; } else { LblMsg.ForeColor = System.Drawing.Color.Green; LblMsg.Text = "ثبت انجام شد."; BindGrid(); } //LightBox.Value = "0"; LblParamAgreeStatus.Text = "0"; }
public void BindGrid() { ClAgreeStatus cl = new ClAgreeStatus(); cl.AgreementID = AgreementID; DataSet ds = AgreeStatusClass.GetList(cl); DataView dv = new DataView(ds.Tables[0]); if (ViewState["AgreeStatus "] == null) { ViewState["AgreeStatus"] = "AgreeStatus Desc"; } dv.Sort = Securenamespace.SecureData.CheckSecurity(ViewState["AgreeStatus"].ToString()).ToString(); GridView1.DataSource = dv; GridView1.DataBind(); }
//--------------------------------------------------------------------------------------------------------- public static DataSet GetList(ClAgreeStatus c) { SqlCommand cmd = new SqlCommand("PRC_AgreeStatus_GetList", cnn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("UserIDLog", SqlDbType.NVarChar)).Value = CSharp.PublicFunction.GetUserID(); cmd.Parameters.Add(new SqlParameter("IpLog", SqlDbType.NVarChar)).Value = CSharp.PublicFunction.GetIPAddress(); cmd.Parameters.Add(new SqlParameter("OSLog", SqlDbType.NVarChar)).Value = CSharp.PublicFunction.GetOS(); cmd.Parameters.Add(new SqlParameter("OSVerLog", SqlDbType.NVarChar)).Value = CSharp.PublicFunction.GetBrowser() + CSharp.PublicFunction.GetBrowserVersion(); cmd.Parameters.Add(new SqlParameter("URLLog", SqlDbType.NVarChar)).Value = CSharp.PublicFunction.GetURL(); cmd.Parameters.Add(new SqlParameter("AgreeStatus", SqlDbType.Int)).Value = Securenamespace.SecureData.CheckSecurity(c.AgreeStatus); cmd.Parameters.Add(new SqlParameter("AgreementID", SqlDbType.Int)).Value = Securenamespace.SecureData.CheckSecurity(c.AgreementID); cmd.Parameters.Add(new SqlParameter("StatusID", SqlDbType.Int)).Value = Securenamespace.SecureData.CheckSecurity(c.StatusID); cmd.Parameters.Add(new SqlParameter("StatusDate", SqlDbType.NVarChar)).Value = Securenamespace.SecureData.CheckSecurity(c.StatusDate); cmd.Parameters.Add(new SqlParameter("RegUser", SqlDbType.Int)).Value = Securenamespace.SecureData.CheckSecurity(c.RegUser); cmd.Parameters.Add(new SqlParameter("RegDate", SqlDbType.NVarChar)).Value = Securenamespace.SecureData.CheckSecurity(c.RegDate); cmd.Parameters.Add(new SqlParameter("AgreeStatusComment", SqlDbType.NVarChar)).Value = Securenamespace.SecureData.CheckSecurity(c.AgreeStatusComment); SqlParameter prmResult = new SqlParameter("Result", SqlDbType.Int); prmResult.Direction = ParameterDirection.Output; cmd.Parameters.Add(prmResult); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd); try { cnn.Open(); da.Fill(ds); return(ds); } catch (Exception ex) { return(null); } finally { cnn.Close(); } }
public static int insert(ClAgreeStatus c) { SqlCommand cmd = new SqlCommand("PRC_AgreeStatus_Insert", cnn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("UserIDLog", SqlDbType.NVarChar)).Value = CSharp.PublicFunction.GetUserID(); cmd.Parameters.Add(new SqlParameter("IpLog", SqlDbType.NVarChar)).Value = CSharp.PublicFunction.GetIPAddress(); cmd.Parameters.Add(new SqlParameter("OSLog", SqlDbType.NVarChar)).Value = CSharp.PublicFunction.GetOS(); cmd.Parameters.Add(new SqlParameter("OSVerLog", SqlDbType.NVarChar)).Value = CSharp.PublicFunction.GetBrowser() + CSharp.PublicFunction.GetBrowserVersion(); cmd.Parameters.Add(new SqlParameter("URLLog", SqlDbType.NVarChar)).Value = CSharp.PublicFunction.GetURL(); cmd.Parameters.Add(new SqlParameter("AgreementID", SqlDbType.Int)).Value = Securenamespace.SecureData.CheckSecurity(c.AgreementID); cmd.Parameters.Add(new SqlParameter("StatusID", SqlDbType.Int)).Value = Securenamespace.SecureData.CheckSecurity(c.StatusID); cmd.Parameters.Add(new SqlParameter("StatusDate", SqlDbType.NVarChar)).Value = Securenamespace.SecureData.CheckSecurity(c.StatusDate); cmd.Parameters.Add(new SqlParameter("RegUser", SqlDbType.Int)).Value = Securenamespace.SecureData.CheckSecurity(c.RegUser); cmd.Parameters.Add(new SqlParameter("RegDate", SqlDbType.NVarChar)).Value = Securenamespace.SecureData.CheckSecurity(c.RegDate); cmd.Parameters.Add(new SqlParameter("AgreeStatusComment", SqlDbType.NVarChar)).Value = Securenamespace.SecureData.CheckSecurity(c.AgreeStatusComment); SqlParameter prmResult = new SqlParameter("Result", SqlDbType.Int); prmResult.Direction = ParameterDirection.Output; cmd.Parameters.Add(prmResult); try { cnn.Open(); cmd.ExecuteNonQuery(); return(Convert.ToInt32(prmResult.Value)); } catch (Exception ex) { return(0); } finally { cnn.Close(); } }