protected void btnDeletet_Click(object sender, EventArgs e) { Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); Js.BLL.Sys.SysComDal sdal = new Js.BLL.Sys.SysComDal(cnKey); // Js.BLL.Sys.SysComDal sdal = new Js.BLL.Sys.SysComDal(); int iReturn = 0; for (int i = 0; i < this.GridView1.Rows.Count; i++) { CheckBox cb = (CheckBox)(this.GridView1.Rows[i].FindControl("cbSelect")); if (cb.Checked) { HyperLink hk = (HyperLink)(this.GridView1.Rows[i].FindControl("HyperLink1")); iReturn = sdal.GetBillCanBeEdit(FormID, hk.Text);// "EnterpriseID='" + Session["EnterpriseID"].ToString() + "'"); if (iReturn == 1) JScript.Instance.ShowMessage(this.updatePanel, hk.Text + Resources.Resource.NotDelete_Checked); else if (iReturn == 2) JScript.Instance.ShowMessage(this.updatePanel, hk.Text + Resources.Resource.NotDelete_IsUsed); else { dal.Delete(hk.Text);//, "EnterpriseID='" + Session["EnterpriseID"].ToString() + "'"); dal.DeleteDetail(hk.Text); } } } SetBtnEnabled(""); }
protected void Page_Load(object sender, EventArgs e) { ID = Request.QueryString["ID"] + ""; FormID = Request.QueryString["FormID"] + ""; if (!IsPostBack) { BindDropDownList(); ViewState["StrWhere"] = string.Format(" MemberID='{0}'", ID); Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); DataTable dt = dal.GetRecord(ViewState["StrWhere"].ToString()); ViewState["dt"] = dt; Js.BLL.Sys.SysComDal sdal = new Js.BLL.Sys.SysComDal(cnKey); BindData(dt); if (sdal.GetBillCanBeEdit(FormID, ID) > 0) this.btnEdit.Enabled = false; } }
/// <summary> /// 綁定查詢 /// </summary> private void dataSearch() { Js.BLL.Sys.SysComDal dal = new Js.BLL.Sys.SysComDal(); this.ddlFieldName.DataSource = dal.SearchTable(FormID, false).Tables[0]; this.ddlFieldName.DataTextField = "FieldCName"; this.ddlFieldName.DataValueField = "FieldName"; this.ddlFieldName.DataBind(); this.ddlPageSize.Items.Add(new ListItem("15", "15")); this.ddlPageSize.Items.Add(new ListItem("20", "20")); this.ddlPageSize.Items.Add(new ListItem("25", "25")); this.ddlPageSize.Items.Add(new ListItem("30", "30")); this.ddlPageSize.Items.Add(new ListItem("40", "40")); this.ddlPageSize.Items.Add(new ListItem("50", "50")); Js.BLL.BaseDal bdal = new Js.BLL.BaseDal("BU_Enterprise"); string filter = "1=1"; if (Session["UserType"].ToString() == "EP") filter = string.Format("EnterpriseID='{0}'", Session["EnterpriseID"].ToString()); this.ddlEnterpriseID.DataSource = bdal.GetIDNameList(filter); this.ddlEnterpriseID.DataTextField = "IDName"; this.ddlEnterpriseID.DataValueField = "ID"; this.ddlEnterpriseID.DataBind(); if (Session["UserType"].ToString() == "BU") this.ddlEnterpriseID.Items.Insert(0, new ListItem("", "")); if (Session["EnterpriseID"] != null) this.ddlEnterpriseID.SelectedValue = Session["EnterpriseID"].ToString(); }
private void dataBind(int PageIndex) { int record_Count = 0; int PageCount =0; Js.BLL.Sys.SysComDal dal = new Js.BLL.Sys.SysComDal(cnKey); DataTable dt = dal.GetSearchSelectSQL(FormID, PageIndex, strWhere, GridView1.PageSize, out PageCount, out record_Count, out SelectField).Tables[0]; string strOptionTxt = ""; DataTable dt1 = dal.SearchTable(FormID, true).Tables[0]; for (int i = 0; i < dt1.Rows.Count; i++) { if (dt1.Rows[i]["FieldType"].ToString().ToLower() == "tinyint" && dt1.Rows[i]["controltype"].ToString().ToLower() == "dropdownlist" && dt1.Rows[i]["OptionText"].ToString().Trim() != "") { if (strOptionTxt=="") strOptionTxt = dt1.Rows[i]["FieldCName"].ToString() + ":" + dt1.Rows[i]["OptionText"].ToString().Trim(); else strOptionTxt += "|" + dt1.Rows[i]["FieldCName"].ToString() + ":" + dt1.Rows[i]["OptionText"].ToString().Trim(); } } optionTxt = strOptionTxt.Split('|'); Field = SelectField.Split(spliter, StringSplitOptions.None); if (dt == null || dt.Rows.Count <= 0) { IsExists = "0"; //Js.Common.MessageBox.Show(this, ""); return; } ViewState["PageCount"] = PageCount; if (PageCount > 0) { this.btnLast.Enabled = true; this.btnFirst.Enabled = true; this.btnToPage.Enabled = true; if (int.Parse(ViewState["CurrentPage"].ToString()) > 1) this.btnPre.Enabled = true; else this.btnPre.Enabled = false; if (int.Parse(ViewState["CurrentPage"].ToString()) < PageCount) this.btnNext.Enabled = true; else this.btnNext.Enabled = false; lblPage.Visible = true; lblPage.Text = "共 [" + record_Count + "] 筆記錄 第 [" + ViewState["CurrentPage"] + "] 頁 共 [" + PageCount + "] 頁"; GridView1.DataSource = dt; GridView1.PageIndex = PageIndex; GridView1.DataBind(); } else { this.btnFirst.Enabled = false; this.btnPre.Enabled = false; this.btnNext.Enabled = false; this.btnLast.Enabled = false; this.btnToPage.Enabled = false; lblPage.Visible = false; GridView1.DataSource = ""; GridView1.DataBind(); } for (int i = 0; i < dt.Columns.Count; i++) { if (dt.Columns[i].DataType.ToString() == "System.DateTime") { } } }
private void Bind() { Js.BLL.Sys.SysComDal dal = new Js.BLL.Sys.SysComDal(); DataTable dt = dal.SearchTable(FormID, false).Tables[0]; this.ddlFieldName.DataSource = dal.SearchTable(FormID, false).Tables[0]; this.ddlFieldName.DataTextField = "FieldCName"; this.ddlFieldName.DataValueField = "FieldCName"; this.ddlFieldName.DataBind(); }
public string LoadAddress(int level, int strNo) { Js.BLL.Sys.SysComDal dal = new Js.BLL.Sys.SysComDal(); DataTable dt; string TableName = "Sys_Address1"; if (level == 1) TableName = "Sys_Address2"; else if (level == 2) TableName = "Sys_Address3"; dt = dal.GetAddress(TableName, strNo).Tables[0]; return Js.Com.JsonHelper.Dtb2Json(dt); }
public void GetAddress(int level, int strNo) { Js.BLL.Sys.SysComDal dal = new Js.BLL.Sys.SysComDal(); StringBuilder sb = new StringBuilder(); DataTable dt; string TableName = "Sys_Address1"; if (level == 1) TableName = "Sys_Address2"; else TableName = "Sys_Address3"; dt = dal.GetAddress(TableName, strNo).Tables[0]; sb.Append("["); for (int i = 0; i < dt.Rows.Count; i++) { sb.Append("{"); sb.AppendFormat(@"""c_name"":""{0}"",", dt.Rows[i]["Name"]); if(level==1) sb.AppendFormat(@"""c_zipno"":""{0}"",", dt.Rows[i]["ZipNo"]); sb.AppendFormat(@"""c_code"":""{0}""", dt.Rows[i]["SerNo"]); sb.Append("}"); if (i < dt.Rows.Count - 1) { sb.Append(","); } } sb.Append("]"); System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); System.Web.HttpContext.Current.Response.Write(sb.ToString()); }
protected void Page_Load(object sender, EventArgs e) { ID = Request.QueryString["ID"] + ""; FormID = Request.QueryString["FormID"] + ""; if (!IsPostBack) { BindDropDownList(); ViewState["StrWhere"] = string.Format(" StyleID='{0}'", ID); Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); DataTable dt = dal.GetRecord(ViewState["StrWhere"].ToString()); ViewState["dt"] = dt; Js.BLL.Sys.SysComDal sdal = new Js.BLL.Sys.SysComDal(cnKey); BindData(dt); if (sdal.GetBillCanBeEdit(FormID, ID) > 0) this.btnEdit.Enabled = false; //this.ddlAntiCounterfeitType.Enabled = false; this.ddlImageLocation.Enabled = false; this.ddlQRContent.Enabled = false; //this.ddlBaseMaterial.Enabled = false; //this.ddlBeAffixedMaterial.Enabled = false; //this.ddlBeAffixedShape.Enabled = false; //this.ddlTextureMaterial.Enabled = false; //this.ddlGlue.Enabled = false; //this.txtLowQuantity.Attributes.Add("style", "text-align:right"); //this.txtSparesPercent.Attributes.Add("style", "text-align:right"); this.txtLength.Attributes.Add("style", "text-align:right"); this.txtWidth.Attributes.Add("style", "text-align:right"); this.txtHeight.Attributes.Add("style", "text-align:right"); writeJsvar(FormID, cnKey, ""); } }
protected void Page_Load(object sender, EventArgs e) { ID = Request.QueryString["ID"] + ""; FormID = Request.QueryString["FormID"] + ""; if (!IsPostBack) { ViewState["StrWhere"] = string.Format(" EnterpriseID='{0}'", ID); Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID); DataTable dt = dal.GetRecord(ViewState["StrWhere"].ToString()); ViewState["dt"] = dt; Js.BLL.Sys.SysComDal sdal = new Js.BLL.Sys.SysComDal(); BindData(dt); } }
protected void Page_Load(object sender, EventArgs e) { ID = Request.QueryString["ID"] + ""; FormID = Request.QueryString["FormID"] + ""; if (!IsPostBack) { ViewState["StrWhere"] = string.Format(" BillID='{0}'", ID); Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); DataTable dt = dal.GetRecord(ViewState["StrWhere"].ToString()); ViewState["dt"] = dt; Js.BLL.Sys.SysComDal sdal = new Js.BLL.Sys.SysComDal(cnKey); BindData(dt); if (sdal.GetBillCanBeEdit(FormID, ID) > 0) this.btnEdit.Enabled = false; if (Session["UserType"] == "BU") { this.btnEPCheck.Visible = false; //this.txtEP_CheckUserName.Width = "90%"; } else { this.btnInvalid.Visible = false; this.btnBUCheck.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { ID = Request.QueryString["ID"] + ""; FormID = Request.QueryString["FormID"] + ""; if (!IsPostBack) { BindDropDownList(); //ViewState["StrWhere"] = string.Format(" BillID='{0}'", ID); Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); DataTable dt = dal.GetViewRecord(string.Format(_strWhere, ID)); Js.BLL.Sys.SysComDal sdal = new Js.BLL.Sys.SysComDal(cnKey); BindData(dt); if (sdal.GetBillCanBeEdit(FormID, ID) > 0) this.btnEdit.Enabled = false; if ("" + Session["UserType"] == "EP") { this.btnBUCheck.Visible = false; // this.GridView1.Columns[7].Visible = false; // this.GridView1.Columns[15].Visible = false; // this.GridView1.Columns[19].Visible = false; // this.GridView1.Columns[24].Visible = false; // this.GridView1.Columns[25].Visible = false; } //else //{ // this.btnEPCheck.Visible = false; //} this.txtTotalPages.Attributes.Add("style", "text-align:right"); writeJsvar(FormID, cnKey, ""); } }
protected void Page_Load(object sender, EventArgs e) { ID = Request.QueryString["ID"] + ""; FormID = Request.QueryString["FormID"] + ""; if (!IsPostBack) { BindDropDownList(); ViewState["StrWhere"] = string.Format(" BillID='{0}'", ID); Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); DataTable dt = dal.GetRecord(ViewState["StrWhere"].ToString()); ViewState["dt"] = dt; Js.BLL.Sys.SysComDal sdal = new Js.BLL.Sys.SysComDal(cnKey); BindData(dt); if (sdal.GetBillCanBeEdit(FormID, ID) > 0) this.btnEdit.Enabled = false; //this.ddlAntiCounterfeitType.Enabled = false; //this.ddlImageLocation.Enabled = false; //this.ddlQRContent.Enabled = false; //this.ddlBaseMaterial.Enabled = false; //this.ddlBeAffixedMaterial.Enabled = false; //this.ddlTextureMaterial.Enabled = false; //this.ddlGlue.Enabled = false; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["cnKey"] != null) cnKey = Session["cnKey"].ToString(); ID = Request.QueryString["ID"] + ""; FormID = Request.QueryString["FormID"] + ""; if (!IsPostBack) { ViewState["StrWhere"] = string.Format(" DepartmentID='{0}' and EnterpriseID='{1}'", ID, Session["EnterpriseID"].ToString()); Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); DataTable dt = dal.GetRecord(ViewState["StrWhere"].ToString()); ViewState["dt"] = dt; Js.BLL.Sys.SysComDal sdal = new Js.BLL.Sys.SysComDal(cnKey); BindData(dt); if (sdal.GetBillCanBeEdit(FormID, ID, "EnterpriseID='" + Session["EnterpriseID"].ToString() + "'") > 0) this.btnEdit.Enabled = false; } }
/// <summary> /// 綁定GirdView /// </summary> /// <param name="pageIndex"></param> private void BindGrid(int pageIndex) { Js.BLL.Sys.SysComDal dal = new Js.BLL.Sys.SysComDal(cnKey); DataSet ds = new DataSet(); int RecordCount, PageCount; string strWhere = ViewState["strWhere"].ToString(); ds = dal.SelectTable(FormID, pageIndex, strWhere, int.Parse(ViewState["PageSize"].ToString()), ViewState["OrderField"].ToString(), out PageCount, out RecordCount); if (ViewState["CurrentPage"].ToString() == "0") ViewState["CurrentPage"] = PageCount; if (RecordCount != 0) { this.btnLast.Enabled = true; this.btnFirst.Enabled = true; this.btnToPage.Enabled = true; if (int.Parse(ViewState["CurrentPage"].ToString()) > 1) this.btnPre.Enabled = true; else this.btnPre.Enabled = false; if (int.Parse(ViewState["CurrentPage"].ToString()) < PageCount) this.btnNext.Enabled = true; else this.btnNext.Enabled = false; lblCurrentPage.Visible = true; lblCurrentPage.Text = "共 [" + RecordCount.ToString() + "] 筆記錄 第 [" + ViewState["CurrentPage"] + "] 頁 共 [" + PageCount.ToString() + "] 頁"; lblCurrentPage.Text = "Records:" + RecordCount.ToString() + " Page:" + ViewState["CurrentPage"] + "/" + PageCount.ToString(); } else { this.btnFirst.Enabled = false; this.btnPre.Enabled = false; this.btnNext.Enabled = false; this.btnLast.Enabled = false; this.btnToPage.Enabled = false; lblCurrentPage.Visible = false; } GridView1.DataSource = ds.Tables[0].DefaultView; GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["cnKey"] != null) cnKey = Session["cnKey"].ToString(); ID = Request.QueryString["ID"] + ""; FormID = Request.QueryString["FormID"] + ""; if (!IsPostBack) { ViewState["StrWhere"] = string.Format(" LogisticsID='{0}' and EnterpriseID='{1}'", ID, Session["EnterpriseID"].ToString()); Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey); DataTable dt = dal.GetRecord(ViewState["StrWhere"].ToString()); ViewState["dt"] = dt; Js.BLL.Sys.SysComDal sdal = new Js.BLL.Sys.SysComDal(cnKey); BindDropDownList(); BindData(dt); //if (sdal.GetBillCanBeEdit(FormID, ID, "EnterpriseID='" + Session["EnterpriseID"].ToString() + "'") > 0) // this.btnEdit.Enabled = false; if (FormID == "EP_ProductLogistics") { this.btnSourceView.Enabled = false; this.btnDelete.Visible = false; this.btnAdd.Visible = false; } else { string filter = string.Format("EnterpriseID='{0}'", Session["EnterpriseID"].ToString()); Js.BLL.BaseDal bdal = new Js.BLL.BaseDal("EP_ProductLogistics", Session["cnKey"].ToString()); if (bdal.Exists(this.txtLogisticsID.Text, filter)) this.btnSourceView.Enabled = true; else this.btnSourceView.Enabled = false; this.ltlTitle.Text = Resources.Resource.EP_ProductLogisticsNoCheckTitle; this.btnModify.Visible = false; } } }
/// <summary> /// 綁定查詢 /// </summary> private void dataSearch() { Js.BLL.Sys.SysComDal dal = new Js.BLL.Sys.SysComDal(); this.ddlFieldName.DataSource = dal.SearchTable(FormID, false).Tables[0]; this.ddlFieldName.DataTextField = "FieldCName"; this.ddlFieldName.DataValueField = "FieldName"; this.ddlFieldName.DataBind(); this.ddlPageSize.Items.Add(new ListItem("15", "15")); this.ddlPageSize.Items.Add(new ListItem("20", "20")); this.ddlPageSize.Items.Add(new ListItem("25", "25")); this.ddlPageSize.Items.Add(new ListItem("30", "30")); this.ddlPageSize.Items.Add(new ListItem("40", "40")); this.ddlPageSize.Items.Add(new ListItem("50", "50")); }
/// <summary> /// 綁定GirdView /// </summary> /// <param name="pageIndex"></param> private void BindGrid(int pageIndex) { Js.BLL.Sys.SysComDal dal = new Js.BLL.Sys.SysComDal(cnKey); DataSet ds = new DataSet(); int RecordCount, PageCount; string strWhere = ViewState["strWhere"].ToString(); ds = dal.SelectTable(FormID, pageIndex, strWhere, int.Parse(ViewState["PageSize"].ToString()), ViewState["OrderField"].ToString(), out PageCount, out RecordCount); if (ViewState["CurrentPage"].ToString() == "0") ViewState["CurrentPage"] = PageCount; if (RecordCount != 0) { this.btnLast.Enabled = true; this.btnFirst.Enabled = true; this.btnToPage.Enabled = true; if (int.Parse(ViewState["CurrentPage"].ToString()) > 1) this.btnPre.Enabled = true; else this.btnPre.Enabled = false; if (int.Parse(ViewState["CurrentPage"].ToString()) < PageCount) this.btnNext.Enabled = true; else this.btnNext.Enabled = false; lblCurrentPage.Visible = true; lblCurrentPage.Text = "共 [" + RecordCount.ToString() + "] 筆記錄 第 [" + ViewState["CurrentPage"] + "] 頁 共 [" + PageCount.ToString() + "] 頁"; lblCurrentPage.Text = "Records:" + RecordCount.ToString() + " Page:" + ViewState["CurrentPage"] + "/" + PageCount.ToString(); } else { this.btnFirst.Enabled = false; this.btnPre.Enabled = false; this.btnNext.Enabled = false; this.btnLast.Enabled = false; this.btnToPage.Enabled = false; lblCurrentPage.Visible = false; } if (ds.Tables[0].Rows.Count > 0) { this.txtUploadDate.Text = Js.Com.PageValidate.ParseDateTime(ds.Tables[0].Rows[0]["UploadDate"].ToString()); if (ds.Tables[0].Rows[0]["State"].ToString() == "0") this.txtState.Text = Resources.Resource.CheckState0; else if (ds.Tables[0].Rows[0]["State"].ToString() == "1") this.txtState.Text = Resources.Resource.CheckState1; else if (ds.Tables[0].Rows[0]["State"].ToString() == "2") this.txtState.Text = Resources.Resource.CheckState2; else this.txtState.Text = Resources.Resource.CheckState3; } else { this.txtUploadDate.Text = ""; this.txtState.Text = ""; } GridView1.DataSource = ds.Tables[0].DefaultView; GridView1.DataBind(); if (this.GridView1.Rows.Count > 0) { if (this.GridView1.Rows[0].Cells[14].Text.Replace(" ", "").Trim().Length > 0) { this.btnCheck.Enabled = false; this.btnUnCheck.Enabled = true; } else { this.btnCheck.Enabled = true; this.btnUnCheck.Enabled = false; } } else { this.btnCheck.Enabled = false; this.btnUnCheck.Enabled = false; } }