Asp.Net Work-About

AQL.aspx 后台:

using System;
using System.Globalization;
using System.Linq;
using BFW.BLL.QM;
using BFW.Model.QM;
using MYCOMPANY.BFW.BLL;

namespace QM.SysBaseSet
{
    public partial class QmSysBaseSetAql : AdminPage
    {
        #region Page_Load
        protected void Page_Load(object sender, EventArgs e)
        {
            //this.BFWGridAQL.Grid.RowDataBound += new GridViewRowEventHandler(Grid_RowDataBound);
            RecordNavigation1.Click += RecordNavigation1_Click;

if (!IsPostBack)
            {
                PageInitializtion();
            }
        }
        #endregion

#region 页面初始化
        private void PageInitializtion()
        {
            PanelQuery.Visible = true;
            PanelEdit.Visible = false;
            ButtonQuery.Text = WebUtility.GetResource("Common_Select");//查询
            ButtonDelete.Text = WebUtility.GetResource("Common_Delete");//删除
            ButtonUpdate.Text = WebUtility.GetResource("Common_Update");//修改
            ButtonNew.Text = WebUtility.GetResource("Common_Insert");//删除
            ButtonReset.Text = WebUtility.GetResource("Common_Reset");//重置
            ButtonRoleSave.Text = WebUtility.GetResource("Common_Save");//保存
            //this.ButtonExport.Text = WebUtility.GetResource("Common_Export");//导出
            ButtonBack.Text = WebUtility.GetResource("Common_Back");//返回
            //this.ButtonAddType.Text = WebUtility.GetResource("QM_AddDefectType");//添加分类
            hideInputTypeName.Value = WebUtility.GetResource("QM_Defect_Name");//请输入缺陷名称
            ModalFrameDetail.Caption = WebUtility.GetResource("Role_Detail");//系统角色明细
            LoadInspectionTypeList();
            BindData();
        }
        #endregion

#region 装载缺陷分类列表
        private void LoadInspectionTypeList()
        {
            var inspectionTypeBll = new InspectionTypeBll();
            using (var dataTable = inspectionTypeBll.GetInspectionTypeList())
            {
                //装载角色列表,用于编辑
                DropdownListEnableQuery.DataSource = dataTable;
                DropdownListEnableQuery.ValueField = "ID";
                DropdownListEnableQuery.TextField = "Name";
                DropdownListEnableQuery.ShowAllItem = true;
                DropdownListEnableQuery.DataBind();
                //装载角色列表,用于查询
                DropdownListEnableEdit.DataSource = dataTable;
                DropdownListEnableEdit.ValueField = "ID";
                DropdownListEnableEdit.TextField = "Name";
                DropdownListEnableEdit.DataBind();
            }
        }
        #endregion
        #region 数据绑定
        private void BindData()
        {
            //封装实体类
            var aqlModel = new AQLModel
            {
                Culture = CurrentCulture,
                CompanyID = CompanyID,
                InspectionTypeID = DropdownListEnableQuery.Value
            };
            //实例化业务层
            var aqlbll = new Aqlbll {ModelObject = aqlModel};
            BFWGridAQL.BLLObject = aqlbll;
            BFWGridAQL.DataFields = new[] { "RowSN", "InspectionName", "Rate", "Yield" };//给DataView控件 绑定字段
            //给 DataView 数据列表 头 汉化
            BFWGridAQL.HeaderText = new[] {
                WebUtility.GetResource("Common_SN"),        //序号
                WebUtility.GetResource("QM_Inspection_Type_Name"),    //检验分类
                WebUtility.GetResource("QM_Inspection_Rate"),//检验比率
                WebUtility.GetResource("QM_Inspection_Yield")//最大不良率
            };
            BFWGridAQL.ColumnWidth = new[] { "10%", "30%", "30%","30%" };//设定每一列的宽度
            BFWGridAQL.DataKeys = new[] { "ID" };//设定 GirdView 控件的主键
            BFWGridAQL.DataBind();//绑定数据

}

//void Grid_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {
        //        e.Row.Cells[2].Text = this.ModalFrameDetail.ShowDCaption("<font color=‘BLUE‘><u>" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Type_Name")) + "</font></u>",
        //                WebUtility.WebRootDirectory() + "/QM/DefectType/DefectType.aspx?OpenType=Query&Type_Name=" + DataBinder.Eval(e.Row.DataItem, "Type_Name"),
        //                WebUtility.GetResource("PMP_Parter_Contactor") + " [" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Type_Name")) + "]");

//    }
        //}
        #endregion

#region 查询
        protected void ButtonQuery_Click(object sender, EventArgs e)
        {
            BFWGridAQL.CurrentPage = "1";
            BindData();
        }
        #endregion

#region 编辑返回
        protected void ButtonBack_Click(object sender, EventArgs e)
        {
            LoadInspectionTypeList();
            PanelQuery.Visible = true;
            PanelEdit.Visible = false;
            BindData();
        }
        #endregion

#region 重置
        private void Reset()
        {
            TextBoxRateEdit.Text = string.Empty;
            DropdownListEnableEdit.SelectedIndex = 0;
            hideID.Value = string.Empty;
            LoadInspectionTypeList();
            TextBoxRateEdit.Focus();
        }
        #endregion

#region 新增
        protected void ButtonNew_Click(object sender, EventArgs e)
        {
            PanelQuery.Visible = false;
            PanelEdit.Visible = true;
            RecordNavigation1.Dispose();
            LoadInspectionTypeList();
            LabelOperState.Text = WebUtility.GetResource("Common_Insert");//新增
            hideOperState.Value = "Insert";
            Reset();
        }
        #endregion

#region 修改前初始化

private void UpdateInitialize(string id)
        {
            var aqlModel = new AQLModel { ID = id };
            var aqlbll = new Aqlbll {ModelObject = aqlModel};
            aqlModel = aqlbll.GetAqlbyId();
            TextBoxRateEdit.Text = aqlModel.Rate.ToString(CultureInfo.InvariantCulture);
            LoadInspectionTypeList();
            DropdownListEnableEdit.Value = aqlModel.InspectionTypeID;
        }

#endregion

#region 修改
        protected void ButtonUpdate_Click(object sender, EventArgs e)
        {

RecordNavigation1.DataSource = BFWGridAQL.SelectedValues;
            hideID.Value = RecordNavigation1.CurrentRecordID;
            UpdateInitialize(RecordNavigation1.CurrentRecordID);
            PanelQuery.Visible = false;

PanelEdit.Visible = true;
            LabelOperState.Text = WebUtility.GetResource("Common_Update");//修改
            hideOperState.Value = "Update";
        }
        #endregion

#region RecordNavigation1_Click
        void RecordNavigation1_Click(object sender, EventArgs e)
        {
            hideID.Value = RecordNavigation1.CurrentRecordID;
            UpdateInitialize(RecordNavigation1.CurrentRecordID);
        }
        #endregion

#region 删除
        protected void ButtonDelete_Click(object sender, EventArgs e)
        {
            int i = BFWGridAQL.SelectedValues.Select(id => new AQLModel {ID = id}).Select(aqlModel => new Aqlbll {ModelObject = aqlModel}).Count(aqlbll => aqlbll.Execute(OperationType.Delete) > 0);
            if (i > 0)
            {
                BindData();
                string message = WebUtility.GetResource("Common_OperSuccess") + "<br/>"
                                 + WebUtility.GetResource("Common_DeletedRecordNum") + i;//操作成功...已成功删除的记录笔数:
                AlertQuery.Alert(message);
            }
            else
            {
                BindData();
                string message = WebUtility.GetResource("Common_OpeError") + "<br/>"
                                 + WebUtility.GetResource("Common_DeletedRecordNum") + i;//操作失敗...已成功操作的记录笔数:
                AlertQuery.Alert(message);
            }
        }
        #endregion

#region 缺陷名称保存(修改)
        protected void ButtonRoleSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TextBoxRateEdit.Text.Trim()))
            {
                MessageBox(WebUtility.GetResource("QM_InputRate"));//请输入检验比率
                return;
            }
            if (string.IsNullOrEmpty(TextBoxYieldEdit.Text.Trim()))
            {
                MessageBox(WebUtility.GetResource("QM_InputYield"));//请输入最大不良率
                return;
            }
            var aqlModel = new AQLModel
            {
                Rate = decimal.Parse(WebUtility.CutString(TextBoxRateEdit.Text.Trim(), 8, false)),
                InspectionTypeID = DropdownListEnableEdit.Value,
                Yield =decimal.Parse(TextBoxYieldEdit.Text.Trim()),
                CompanyID = CompanyID
            };
            var aqlbll = new Aqlbll {ModelObject = aqlModel};
            //插入操作
            if (hideOperState.Value.Equals("Insert"))
            {
                hideID.Value = Guid.NewGuid().ToString();
                aqlModel.ID = hideID.Value;
                aqlModel.Creator = UserID;
                aqlModel.CreateDate = DateTime.Now;
                //bool b = AQLBLL.DataDoubleCheck(AQLModel.ID, AQLModel.AQL);
                //if (b == true)
                //{
                //    MessageBox(WebUtility.GetResource("ePO_Common_DataDouble"));//数据已存在,不允许重复
                //    return;
                //}
                if (aqlbll.Execute(OperationType.Insert) > 0)
                {
                    BindData();
                    MessageBox(WebUtility.GetResource("Common_OperSuccess"));//操作成功
                    PanelQuery.Visible = true;
                    PanelEdit.Visible = false;
                    BFWGridAQL.Visible = true;
                }
            }
            else
            {
                //1,先将 要修改的数据 封装到实体中
                aqlModel.ID = hideID.Value;
                aqlModel.Modifier = UserID;
                aqlModel.ModifyDate = DateTime.Now;
                //bool b = AQLBLL.DataDoubleCheck(AQLModel.ID, AQLModel.AQL);
                //if (b == true)
                //{
                //    MessageBox(WebUtility.GetResource("ePO_Common_DataDouble"));//数据已存在,不允许重复
                //    return;
                //}
                //2,调用 业务层的 更新方法
                if (aqlbll.Execute(OperationType.Update) > 0)
                {
                    BindData();
                    MessageBox(WebUtility.GetResource("Common_OperSuccess"));//操作成功
                }
            }
        }

protected void ButtonReset_Click(object sender, EventArgs e)
        {
            TextBoxRateEdit.Text = string.Empty;
            TextBoxYieldEdit.Text = string.Empty;
            DropdownListEnableQuery.SelectedIndex = 0;
            BindData();
        }
        #endregion
    }
}

AQL.aspx 前台:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AQL.aspx.cs" Inherits="QM.SysBaseSet.QmSysBaseSetAql" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <ajaxToolkit:ToolkitScriptManager runat="Server" EnablePartialRendering="true" ID="ScriptManager1" />
    <!--查询Panel-->
    <asp:Panel runat="server" ID="PanelQuery">
        <table style="width: 100%; height: 22px; border: 0px;" cellpadding=‘0‘ cellspacing=‘0‘>
            <tr>
                <td class="tableHeaderLeftBG">
                </td>
                <td class="tableHeaderBG">
                    &nbsp;&nbsp;<%=WebUtility.GetResource("Common_QueryCondition")%><%--查询条件--%></td>
                <td class="tableHeaderRightBG">
                </td>
            </tr>
        </table>
        <table style="width: 100%; border: 0px;" cellpadding=‘0‘ cellspacing=‘1‘ class="table">
            <tr style="text-align: left; height: 25px;" class="tableText">
                <td style="width: 10%;">
                    &nbsp;&nbsp;<%=WebUtility.GetResource("QM_Inspection_Type_Name")%><%--检验分类--%></td>
                <td style="width: 40%;">
                    <BFW:DropdownList ID="DropdownListEnableQuery" runat="server" EnableEdit="false"
                        PopupHeight="80px" />
                </td>
               
            </tr>
        </table>
        <table cellpadding=‘0‘ cellspacing=‘0‘>
            <tr style="height: 25px; vertical-align: bottom;">
                <td>
                    <asp:Button ID="ButtonQuery" runat="server" OnClick="ButtonQuery_Click" />&nbsp;
                </td>
                <td>
                    <asp:Button ID="ButtonReset" runat="server" OnClick="ButtonReset_Click" />&nbsp;&nbsp;&nbsp;
                </td>
                <td>
                    <asp:Button ID="ButtonNew" runat="server" CommandName="insert" OnClick="ButtonNew_Click" />&nbsp;
                </td>
                <td>
                    <asp:Button ID="ButtonUpdate" runat="server" CommandName="update" OnClick="ButtonUpdate_Click"
                        OnClientClick="return Select();" />&nbsp;
                </td>
                <td>
                    <asp:Button ID="ButtonDelete" runat="server" CommandName="delete" OnClick="ButtonDelete_Click"
                        OnClientClick="return Delete(this);" />&nbsp;
                </td>
             
            </tr>
        </table>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <BFW:GridView ID="BFWGridAQL" runat="server" ShowCheckBoxColumn="True" EnableSelectRow="false" />
                <BFW:Alert ID="AlertQuery" runat="server" />
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="ButtonQuery" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="ButtonDelete" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
    </asp:Panel>
    <!--角色新增或修改Panel-->
    <asp:Panel runat="server" ID="PanelEdit">
        <table style="width: 100%; height: 22px; border: 0px;" cellpadding=‘0‘ cellspacing=‘0‘>
            <tr>
                <td class="tableHeaderLeftBG">
                </td>
                <td class="tableHeaderBG">
                    &nbsp;&nbsp;<asp:Label ID="LabelOperState" runat="server" SkinID="SkinTitle"></asp:Label>
                </td>
                <td class="tableHeaderRightBG">
                </td>
            </tr>
        </table>
        <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <table style="width: 100%; border: 0px;" cellpadding=‘0‘ cellspacing=‘1‘ class="table">
                    <tr style="text-align: left; height: 25px;" class="tableText">
                        <td style="width: 12%;">
                            &nbsp;&nbsp;<%=WebUtility.GetResource("QM_Inspection_Type_Name")%><%--检验分类--%></td>
                        <td style="width: 38%;">
                            <BFW:DropdownList ID="DropdownListEnableEdit" runat="server" EnableEdit="false"
                        PopupHeight="80px" />
                        </td>
 <td style="width: 12%;">
                            &nbsp;&nbsp;<%=WebUtility.GetResource("QM_Inspection_Rate")%><%--检验比率--%>&nbsp;<font class="Star">*</font>
                        </td>
                        <td style="width: 38%;">
                            &nbsp;&nbsp;<asp:TextBox ID="TextBoxRateEdit" runat="server"></asp:TextBox>
                        </td>                      
                    </tr>
                      <tr style="text-align: left; height: 25px;" class="tableText">
                        <td style="width: 12%;">
                             &nbsp;&nbsp;<%=WebUtility.GetResource("QM_Inspection_Yield")%><%--最大不良率--%>&nbsp;<font class="Star">*</font>

</td>
                          <td style="width: 38%;">
                            &nbsp;&nbsp;<asp:TextBox ID="TextBoxYieldEdit" runat="server"></asp:TextBox>
                        </td>     
                </table>
                <asp:HiddenField ID="hideID" runat="server" />
                <BFW:RecordNavigation ID="RecordNavigation1" runat="server" />
            </ContentTemplate>
        </asp:UpdatePanel>
        <table cellpadding=‘0‘ cellspacing=‘0‘>
            <tr style="height: 25px; vertical-align: bottom;">
                <td>
                    <asp:Button ID="ButtonRoleSave" runat="server" OnClick="ButtonRoleSave_Click" UseSubmitBehavior="false"
                        OnClientClick="Submit(this);" />&nbsp;
                </td>
                <td>
                    <asp:Button ID="ButtonBack" runat="server" OnClick="ButtonBack_Click" />&nbsp;
                </td>
            </tr>
        </table>
    </asp:Panel>
   
    <BFW:UpdateProgress ID="UpdateProgress1" runat="server" />
    <BFW:Confirm ID="Confirm1" runat="server" />
    <BFW:ModalFrame ID="ModalFrameDetail" Width="620px" Height="520px" runat="server" />
   
    <asp:HiddenField ID="hideUpdateIndex" runat="server" />
    <asp:HiddenField ID="hideOperState" runat="server" />
    <asp:HiddenField ID="hideInputTypeName" runat="server" />
    </form>
</body>
</html>

时间: 2024-10-06 08:40:03

Asp.Net Work-About的相关文章

大家好

http://www.yugaopian.com/people/259723 http://www.yugaopian.com/people/259744 http://www.yugaopian.com/people/259783 http://www.yugaopian.com/people/259824 http://www.yugaopian.com/people/259839 http://www.yugaopian.com/people/259933 http://www.yugao

阿哥吗卡怪每次哦阿哥看啦过啦嘎开吃麻辣个啊蓝光

http://www.xx186.com/web/web_kpic.asp?id=156613http://www.xx186.com/web/web_kpic.asp?id=156608http://www.xx186.com/web/web_kpic.asp?id=156605http://www.xx186.com/web/web_kpic.asp?id=156602http://www.xx186.com/web/web_kpic.asp?id=156600http://www.xx18

风格更家霍建华

http://www.9ku.com/fuyin/daogaoo.asp?dgid=119864http://www.9ku.com/fuyin/daogaoo.asp?dgid=119867http://www.9ku.com/fuyin/daogaoo.asp?dgid=119876http://www.9ku.com/fuyin/daogaoo.asp?dgid=119879http://www.9ku.com/fuyin/daogaoo.asp?dgid=119883http://www

,了可美军以本合同个v分

http://shike.gaotie.cn/zhan.asp?zhan=%A1%FE%CE%F7%B0%B2%B8%B4%B7%BD%B5%D8%B7%D2%C5%B5%F5%A5%C6%AC%C4%C4%C0%EF%C2%F2Q%A3%BA%A3%B1%A3%B1%A3%B2%A3%B7%A3%B4%A3%B0%A3%B1%A3%B1%A3%B7%A3%B5%A1%F4 http://shike.gaotie.cn/zhan.asp?zhan=%A8%7D%CD%AD%B4%A8%B8%B4

ASP.NET MVC 使用Remote特性实现远程属性验证

RemoteAttribute是asp.net mvc 的一个验证特性,它位于System.Web.Mvc命名空间 下面通过例子来说明 很多系统中都有会员这个功能,会员在前台注册时,用户名不能与现有的用户名重复,还要求输入手机号码去注册,同时手机号码也需要验证是否重复,下面是实体类 /// <summary> /// 会员 /// </summary> public class Member { public int Id { get; set; } [Required(Error

asp.net264简单汽车小程序

转载于我帮你毕业设计 有需要的可以加Q 97095639 文章在www.hongtaibysj.com 上看到,想查看详细的可以自己去查阅 一.技术实现: 开发语言: asp.net, 框架: mvc ,模式:B/S 数据库 : sqlserver , 开发工具: vs sqlserver . 论文字数:1万左右. 二.功能实现: 三.系统截图

搭建连接MySql的三层架构的ASP.NetCore2.0的WebApi

里我们用三层架构搭建一个连接MySql的ASP.netCore模板的WebApi项目 首先添加WebApi项目(ASP.NetCore版本) 右键解决方案>新建项目> 选择Web>ASP.NET Core Web应用程序(.NET Core) 选择Web API 此时的目录结构: 添加实体层Entity 右键添加>新建项目>.Net Core类库 添加后的目录结构 BaseEntity: using System; using System.Collections.Gener

微微信.NET:开源的ASP.NET微信公众号应用平台

题记: 平时喜欢使用 C# 编程,近半年玩微信公众平台,看到一些微信的应用系统大多是PHP.Python的,于是就有想法做一套开放的 C# ASP.NET的微信应用系统. 微微信.NET  基于ASP.NET的开源微信应用平台  --(面向客户完全开源 永久免费代码更新 游戏和点餐菜单正在完善中 很多功能继续优化) 微微信.NET  系统设计架构         本系统基于文件系统和内存数据库,标准板运行于.NET4,完全版需要单独的服务器或者VPS支持          本系统是一个开源系统,

95后实习生的远程办公体验(asp.net mvc\C#技术栈)

这个月我们做了一件别人看起来很疯狂的事情,就是让一批95后的实习生实行远程办公,效果还不错,于是写此文总结一下. 其实认真算算,我自己的远程工作经验有十年了吧,在北京工作的时候天气不好就申请在家办公,在硅谷的时候每周有三天在家办公,两天去办公室办公.所以我也算得上是远程办公的老司机了吧. 不过,我之前都是对有多年工作经验的老司机才实行远程办公,还从来没有对还未毕业的实习生实行过.老实说,不敢啊,也不放心,况且我在cnblogs博客园呆了十年,还真没见过对还未毕业的实习生实行过远程办公的. 那为什

ASP.NET取得Request URL的各个部分

ASP.NET取得Request URL的各个部分  网址:http://localhost:1897/News/Press/Content.aspx/123?id=1#toc Request.ApplicationPath / Request.PhysicalPath D:\Projects\Solution\web\News\Press\Content.aspx System.IO.Path.GetDirectoryName(Request.PhysicalPath) D:\Projects