Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (IsPageValid())
            {
                try
                {
                    int id = Convert.ToInt32(Request["ToolApplyId"].ToString());
                    ToolInfo t = new ToolInfo(id);
                    t.ManagerView = txtManagerView.Text.ToString();
                    if (rblOver.Items[0].Selected)
                    {
                        t.State = 5;
                        t.Save();
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('您让申请人修正!');</script>");

                    }
                    else if (rblOver.Items[1].Selected)
                    {
                        t.State = 4;
                        t.Save();
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('审批通过!');</script>");

                    }

                }
                catch (Exception Ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('保存失败:" + Ex.Message + "');", true);
                }
            }
        }
Пример #2
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     int id = Convert.ToInt32(((Button)sender).CommandArgument.ToString());
     ToolInfo wt = new ToolInfo(id);
     wt.State = 1;
     wt.ApplyTime = DateTime.Now.ToString("yyyy-MM-dd");
     wt.Save();
     gvDataBind();
 }
Пример #3
0
        protected void PageInit()
        {
            int toolid = Convert.ToInt32(Request["ToolApplyId"].ToString());
            ToolInfo tool = new ToolInfo(toolid);
            txtMarketMemo.Text = tool.MarketMemo.ToString();
            txtTechMemo.Text = tool.TechMemo.ToString();
            txtHrMemo.Text = tool.ZongHeMemo.ToString();
            lblDepartName.Text = tool.DepartName.ToString();
            lblDepartView.Text = tool.DepartView.ToString();
            lblManagerView.Text = tool.ManagerView.ToString();

            ToolNumInfo toolnum = new ToolNumInfo(Convert.ToInt32(tool.ToolNumId));
            lbl1.Text = toolnum.Num1.ToString();
            lbl2.Text = toolnum.Num2.ToString();
            lbl3.Text = toolnum.Num3.ToString();
            lbl4.Text = toolnum.Num4.ToString();
            lbl5.Text = toolnum.Num5.ToString();
            lbl6.Text = toolnum.Num6.ToString();
            lbl7.Text = toolnum.Num7.ToString();
            lbl8.Text = toolnum.Num8.ToString();
            lbl9.Text = toolnum.Num9.ToString();
            lbl10.Text = toolnum.Num10.ToString();
            lbl11.Text = toolnum.Num11.ToString();
            lbl12.Text = toolnum.Num12.ToString();
            lbl13.Text = toolnum.Num13.ToString();
            lbl14.Text = toolnum.Num14.ToString();
            lbl15.Text = toolnum.Num15.ToString();
            lbl16.Text = toolnum.Num16.ToString();
            lbl17.Text = toolnum.Num17.ToString();
            lbl18.Text = toolnum.Num18.ToString();
            lbl19.Text = toolnum.Num19.ToString();
            lbl20.Text = toolnum.Num20.ToString();
            lbl21.Text = toolnum.Num21.ToString();
            lbl22.Text = toolnum.Num22.ToString();
            lbl23.Text = toolnum.Num23.ToString();
            lbl24.Text = toolnum.Num24.ToString();
            lbl25.Text = toolnum.Num25.ToString();
            lbl26.Text = toolnum.Num26.ToString();
            lbl27.Text = toolnum.Num27.ToString();
            lbl28.Text = toolnum.Num28.ToString();
            lbl29.Text = toolnum.Num29.ToString();
            lbl30.Text = toolnum.Num30.ToString();
            lbl31.Text = toolnum.Num31.ToString();
            lbl32.Text = toolnum.Num32.ToString();
            lbl33.Text = toolnum.Num33.ToString();
            lbl34.Text = toolnum.Num34.ToString();
            lbl35.Text = toolnum.Num35.ToString();
            lbl36.Text = toolnum.Num36.ToString();
            lbl37.Text = toolnum.Num37.ToString();
            lbl38.Text = toolnum.Num38.ToString();
            lbl39.Text = toolnum.Num39.ToString();
            lbl40.Text = toolnum.Num40.ToString();
        }
Пример #4
0
        protected void gvTool_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //鼠标移动到每项时颜色交替效果
                e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e");
                //设置悬浮鼠标指针形状为"小手"
                e.Row.Attributes["style"] = "Cursor:hand";

                if (!Convert.IsDBNull(gvTool.DataKeys[e.Row.RowIndex].Value))
                {
                    int id = Convert.ToInt32(gvTool.DataKeys[e.Row.RowIndex].Value);
                    ToolInfo t = new ToolInfo(id);
                    if (t.State != 0)
                    {
                        Button btnSubmit = e.Row.FindControl("btnSubmit") as Button;
                        Button btnEdit = e.Row.FindControl("btnEdit") as Button;
                        Button btnDelete = e.Row.FindControl("btnDelete") as Button;
                        btnSubmit.Enabled = false;
                        btnEdit.Enabled = false;
                        btnDelete.Enabled = false;
                    }

                    Label lblState = e.Row.FindControl("lblState") as Label;

                    switch (t.State)
                    {
                        case 0:
                            lblState.Text = "未提交";
                            break;
                        case 1:
                            lblState.Text = "待部门领导审批";
                            break;
                        case 2:
                            lblState.Text = "部门:修正";
                            break;
                        case 3:
                            lblState.Text = "待总经理审批";
                            break;
                        case 4:
                            lblState.Text = "通过";
                            break;
                        case 5:
                            lblState.Text = "总经理:修正";
                            break;
                        default:
                            lblState.Text = "其他状态";
                            break;
                    }
                }
            }
        }
Пример #5
0
        public ToolInfo GetToolInfoById(int ToolId)
        {
            ToolInfo toolInfo = null;             //

            try
            {
                toolInfo = new ToolInfo(ToolId);
            }
            catch (AppException)
            {
                return(null);
            }

            return(toolInfo);
        }
Пример #6
0
        public ToolInfo GetToolInfoById(int ToolId)
        {
            ToolInfo toolInfo  = null;//
            try
            {
                 toolInfo = new ToolInfo(ToolId);

            }
            catch (AppException)
            {
                return null;
            }

            return  toolInfo;
        }
Пример #7
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
                {

                    int toolid = Convert.ToInt32(Request["ToolApplyId"].ToString());
                        ToolInfo tool = new ToolInfo(toolid);

                        ToolNumInfo toolnum = new ToolNumInfo(Convert.ToInt32(tool.ToolNumId));
                        toolnum.Num1 = txt1.Text.ToString();
                        toolnum.Num2 = txt2.Text.ToString();
                        toolnum.Num3 = txt3.Text.ToString();
                        toolnum.Num4 = txt4.Text.ToString();
                        toolnum.Num5 = txt5.Text.ToString();
                        toolnum.Num6 = txt6.Text.ToString();
                        toolnum.Num7 = txt7.Text.ToString();
                        toolnum.Num8 = txt8.Text.ToString();
                        toolnum.Num9 = txt9.Text.ToString();
                        toolnum.Num10 = txt10.Text.ToString();
                        toolnum.Num11 = txt11.Text.ToString();
                        toolnum.Num12 = txt12.Text.ToString();
                        toolnum.Num13 = txt13.Text.ToString();
                        toolnum.Num14 = txt14.Text.ToString();
                        toolnum.Num15 = txt15.Text.ToString();
                        toolnum.Num16 = txt16.Text.ToString();
                        toolnum.Num17 = txt17.Text.ToString();
                        toolnum.Num18 = txt18.Text.ToString();
                        toolnum.Num19 = txt19.Text.ToString();
                        toolnum.Num20 = txt20.Text.ToString();
                        toolnum.Num21 = txt21.Text.ToString();
                        toolnum.Num22 = txt22.Text.ToString();
                        toolnum.Num23 = txt23.Text.ToString();
                        toolnum.Num24 = txt24.Text.ToString();
                        toolnum.Num25 = txt25.Text.ToString();
                        toolnum.Num26 = txt26.Text.ToString();
                        toolnum.Num27 = txt27.Text.ToString();
                        toolnum.Num28 = txt28.Text.ToString();
                        toolnum.Num29 = txt29.Text.ToString();
                        toolnum.Num30 = txt30.Text.ToString();
                        toolnum.Num31 = txt31.Text.ToString();
                        toolnum.Num32 = txt32.Text.ToString();
                        toolnum.Num33 = txt33.Text.ToString();
                        toolnum.Num34 = txt34.Text.ToString();
                        toolnum.Num35 = txt35.Text.ToString();
                        toolnum.Num36 = txt36.Text.ToString();
                        toolnum.Num37 = txt37.Text.ToString();
                        toolnum.Num38 = txt38.Text.ToString();
                        toolnum.Num39 = txt39.Text.ToString();
                        toolnum.Num40 = txt40.Text.ToString();
                        toolnum.Save();

                        tool.MarketMemo = txtMarketMemo.Text.ToString();
                        tool.TechMemo = txtTechMemo.Text.ToString();
                        tool.ZongHeMemo = txtHrMemo.Text.ToString();
                        tool.DepartView = txtDepartView.Text.ToString();
                        tool.Save();
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('����ɹ���');</script>");

                }
                catch (Exception Ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('����ʧ�ܣ�" + Ex.Message + "');", true);
                }
        }
Пример #8
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<ToolInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(ToolInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< ToolInfo>;
     }
     else
     {
         List< ToolInfo>  list =new List< ToolInfo>();
         ToolCollection  collection=new  ToolCollection();
         Query qry = new Query(Tool.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(Tool tool in collection)
         {
             ToolInfo toolInfo= new ToolInfo();
             LoadFromDAL(toolInfo,tool);
             list.Add(toolInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(ToolInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }
Пример #9
0
 public object  SaveToolInfo(ToolInfo toolInfo)
 {
     toolInfo.Save();
     return(toolInfo.ToolId);
 }
Пример #10
0
 public List <ToolInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
 {
     return(ToolInfo.GetPagedList(pPageIndex, pPageSize, pOrderBy, pSortExpression, out pRecordCount));
 }
Пример #11
0
 public List <ToolInfo> GetToolInfoList()
 {
     return(ToolInfo.GetList());
 }
Пример #12
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(ToolInfo pToolInfoTo)
 {
     Copy(this,  pToolInfoTo);
 }
Пример #13
0
        public void DeleteById(ToolInfo pToolInfo)
        {
            ToolInfo toolInfo = new ToolInfo(pToolInfo.ToolId);

            toolInfo.Delete();
        }
Пример #14
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(ToolInfo pToolInfoFrom, ToolInfo pToolInfoTo)
 {
     pToolInfoTo.ToolId = pToolInfoFrom.toolId;
      		pToolInfoTo.ToolNumId = pToolInfoFrom.toolNumId;
      		pToolInfoTo.ApplyTime = pToolInfoFrom.applyTime;
      		pToolInfoTo.DepartName = pToolInfoFrom.departName;
      		pToolInfoTo.ApplyName = pToolInfoFrom.applyName;
      		pToolInfoTo.State = pToolInfoFrom.state;
      		pToolInfoTo.TechMemo = pToolInfoFrom.techMemo;
      		pToolInfoTo.MarketMemo = pToolInfoFrom.marketMemo;
      		pToolInfoTo.ZongHeMemo = pToolInfoFrom.zongHeMemo;
      		pToolInfoTo.DepartView = pToolInfoFrom.departView;
      		pToolInfoTo.ManagerView = pToolInfoFrom.managerView;
     pToolInfoTo.Loaded=pToolInfoFrom.Loaded;
 }
Пример #15
0
 public void DeleteById(ToolInfo pToolInfo)
 {
     ToolInfo toolInfo = new ToolInfo(pToolInfo.ToolId);
     toolInfo.Delete();
 }
Пример #16
0
 //数据持久化
 internal static void SaveToDb(ToolInfo pToolInfo, Tool  pTool,bool pIsNew)
 {
     pTool.ToolId = pToolInfo.toolId;
      		pTool.ToolNumId = pToolInfo.toolNumId;
      		pTool.ApplyTime = pToolInfo.applyTime;
      		pTool.DepartName = pToolInfo.departName;
      		pTool.ApplyName = pToolInfo.applyName;
      		pTool.State = pToolInfo.state;
      		pTool.TechMemo = pToolInfo.techMemo;
      		pTool.MarketMemo = pToolInfo.marketMemo;
      		pTool.ZongHeMemo = pToolInfo.zongHeMemo;
      		pTool.DepartView = pToolInfo.departView;
      		pTool.ManagerView = pToolInfo.managerView;
     pTool.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pTool.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(ToolInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pToolInfo.toolId = pTool.ToolId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(ToolInfo)))
     {
         ResetCache();
     }
 }
Пример #17
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< ToolInfo> pList, ToolCollection pCollection)
 {
     foreach (Tool tool in pCollection)
     {
         ToolInfo toolInfo = new ToolInfo();
         LoadFromDAL(toolInfo, tool );
         pList.Add(toolInfo);
     }
 }
Пример #18
0
 //从后台获取数据
 internal static void LoadFromDAL(ToolInfo pToolInfo, Tool  pTool)
 {
     pToolInfo.toolId = pTool.ToolId;
      		pToolInfo.toolNumId = pTool.ToolNumId;
      		pToolInfo.applyTime = pTool.ApplyTime;
      		pToolInfo.departName = pTool.DepartName;
      		pToolInfo.applyName = pTool.ApplyName;
      		pToolInfo.state = pTool.State;
      		pToolInfo.techMemo = pTool.TechMemo;
      		pToolInfo.marketMemo = pTool.MarketMemo;
      		pToolInfo.zongHeMemo = pTool.ZongHeMemo;
      		pToolInfo.departView = pTool.DepartView;
      		pToolInfo.managerView = pTool.ManagerView;
     pToolInfo.Loaded=true;
 }
Пример #19
0
        protected void PageInit()
        {
            int toolid = Convert.ToInt32(Request["ToolApplyId"].ToString());
            ToolInfo tool = new ToolInfo(toolid);

            txtMarketMemo.Text = tool.MarketMemo.ToString();
            txtTechMemo.Text = tool.TechMemo.ToString();
            txtHrMemo.Text = tool.ZongHeMemo.ToString();
            txtDepartView.Text = tool.DepartView.ToString();
            lblDepartName.Text = tool.DepartName.ToString();

            ToolNumInfo toolnum = new ToolNumInfo(Convert.ToInt32(tool.ToolNumId));
            txt1.Text = toolnum.Num1.ToString();
            txt2.Text = toolnum.Num2.ToString();
            txt3.Text = toolnum.Num3.ToString();
            txt4.Text = toolnum.Num4.ToString();
            txt5.Text = toolnum.Num5.ToString();
            txt6.Text = toolnum.Num6.ToString();
            txt7.Text = toolnum.Num7.ToString();
            txt8.Text = toolnum.Num8.ToString();
            txt9.Text = toolnum.Num9.ToString();
            txt10.Text = toolnum.Num10.ToString();
            txt11.Text = toolnum.Num11.ToString();
            txt12.Text = toolnum.Num12.ToString();
            txt13.Text = toolnum.Num13.ToString();
            txt14.Text = toolnum.Num14.ToString();
            txt15.Text = toolnum.Num15.ToString();
            txt16.Text = toolnum.Num16.ToString();
            txt17.Text = toolnum.Num17.ToString();
            txt18.Text = toolnum.Num18.ToString();
            txt19.Text = toolnum.Num19.ToString();
            txt20.Text = toolnum.Num20.ToString();
            txt21.Text = toolnum.Num21.ToString();
            txt22.Text = toolnum.Num22.ToString();
            txt23.Text = toolnum.Num23.ToString();
            txt24.Text = toolnum.Num24.ToString();
            txt25.Text = toolnum.Num25.ToString();
            txt26.Text = toolnum.Num26.ToString();
            txt27.Text = toolnum.Num27.ToString();
            txt28.Text = toolnum.Num28.ToString();
            txt29.Text = toolnum.Num29.ToString();
            txt30.Text = toolnum.Num30.ToString();
            txt31.Text = toolnum.Num31.ToString();
            txt32.Text = toolnum.Num32.ToString();
            txt33.Text = toolnum.Num33.ToString();
            txt34.Text = toolnum.Num34.ToString();
            txt35.Text = toolnum.Num35.ToString();
            txt36.Text = toolnum.Num36.ToString();
            txt37.Text = toolnum.Num37.ToString();
            txt38.Text = toolnum.Num38.ToString();
            txt39.Text = toolnum.Num39.ToString();
            txt40.Text = toolnum.Num40.ToString();
        }
Пример #20
0
 public object SaveToolInfo(ToolInfo toolInfo)
 {
     toolInfo.Save();
     return toolInfo . ToolId;
 }
Пример #21
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List<ToolInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< ToolInfo> list = new List< ToolInfo>();

            Query q = Tool .CreateQuery();
            q.PageIndex = pPageIndex;
            q.PageSize = pPageSize;
            q.ORDER_BY(pSortExpression,pOrderBy.ToString());
            ToolCollection  collection=new  ToolCollection();
             	collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (Tool  tool  in collection)
            {
                ToolInfo toolInfo = new ToolInfo();
                LoadFromDAL(toolInfo,   tool);
                list.Add(toolInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }