public void BindGrid() { ClAgreeExplanRepeat cl = new ClAgreeExplanRepeat(); cl.SubjectID = Convert.ToInt32(ddSubjectFilter.SelectedValue); if (NotDefaultAgree == false) { cl.AgreementID = 0; } else { cl.AgreementID = Convert.ToInt32(LblAgreementID.Text); } cl.AgreementID = AgrrementID; DataSet ds = AgreeExplanRepeatClass.GetList(cl); DataView dv = new DataView(ds.Tables[0]); if (ViewState["ExplanRepeatID"] == null) { ViewState["ExplanRepeatID"] = "ExplanRepeatID Desc"; } dv.Sort = Securenamespace.SecureData.CheckSecurity(ViewState["ExplanRepeatID"].ToString()).ToString(); GridView1.DataSource = dv; GridView1.DataBind(); }
protected void BtnSerach_Click(object sender, EventArgs e) { DataSet ds = AgreeExplanRepeatClass.GetList(Data); DataView dv = new DataView(ds.Tables[0]); if (ViewState["ExplanRepeatID"] == null) { ViewState["ExplanRepeatID"] = "ExplanRepeatID Desc"; } dv.Sort = Securenamespace.SecureData.CheckSecurity(ViewState["ExplanRepeatID"].ToString()).ToString(); GridView1.DataSource = dv; GridView1.DataBind(); }
protected void BtnInsert_Click(Object sender, System.EventArgs e) { ClAgreeExplanRepeat cl = new ClAgreeExplanRepeat(); cl = Data; if (NotDefaultAgree == false) { cl.AgreementID = null; } else { cl.AgreementID = Convert.ToInt32(LblAgreementID.Text); } if (NotDefaultAgree == false) { cl.AgreementID = null; } int t = 0; if (CSharp.PublicFunction.ModeInsert(ExplanRepeatID.ToString())) { t = AgreeExplanRepeatClass.insert(cl); } else { t = AgreeExplanRepeatClass.Update(cl); } if (t == 0) { LblMsg.ForeColor = System.Drawing.Color.Red; LblMsg.Text = "خطا در ثبت"; } else if (t == -1) { CSharp.Utility.ShowMsg(Page, CSharp.ProPertyData.MsgType.warning, "برای این شرح کار تکرار ثبت شده است"); } else { LblMsg.ForeColor = System.Drawing.Color.Green; LblMsg.Text = "ثبت انجام شد."; BindGrid(); } LblParamExplanRepeatID.Text = "0"; }
public void DeleteItem(object sender, System.EventArgs e) { String ExplanRepeatID = ((HtmlAnchor)sender).HRef.ToString(); int i = AgreeExplanRepeatClass.Delete(ExplanRepeatID); if (i == 0) { LblMsg.Text = " error "; ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('خطا در حذف');", true); } else { BindGrid(); } LightBox.Value = "0"; }