예제 #1
0
        /// <summary>
        ///
        /// </summary>
        private void BindDataGrid()
        {
            var source = SqlService.Where(string.Format(@"SELECT * FROM dbo.vm_SalesDetails a WHERE keyId='{0}' and FCompanyId={1}", lblKeyId.Text, CurrentUser.AccountComId));

            //绑定数据源
            Grid1.DataSource = source;
            Grid1.DataBind();

            var table = source.Tables[0];

            if (table != null && table.Rows.Count > 0)
            {
                decimal sumFQty    = 0.00M;
                decimal sumFAmount = 0.00M;

                for (int i = 0; i < table.Rows.Count; i++)
                {
                    sumFQty    += Convert.ToDecimal(table.Rows[i]["FQty"]);
                    sumFAmount += Convert.ToDecimal(table.Rows[i]["FAmount"]);
                }

                var summary = new JObject
                {
                    { "FItemCode", "合计" },
                    { "FQty", sumFQty },
                    { "FAmount", sumFAmount }
                };

                Grid1.SummaryData = summary;
            }

            //----------------------------------------------------------
            var dataStatus = SqlService.Where(string.Format(@"SELECT FId
      ,KeyId
      ,a.FCompanyId
      ,FDeptId
      ,b.org_name FDeptName
      ,FOperator
      ,FDate
      ,FActionName
      ,FMemo
  FROM dbo.LHBillStatus a
  LEFT JOIN dbo.base_orgnization b ON a.FDeptId=b.id WHERE KeyId='{0}' and a.FCompanyId={1}", lblKeyId.Text, CurrentUser.AccountComId));

            //绑定数据源
            Grid2.DataSource = dataStatus;
            Grid2.DataBind();
            //----------------------------------------------------------
            var dataFlow = SqlService.Where(string.Format(@"SELECT FId
      ,KeyId
      ,a.FCompanyId
      ,FDeptId
      ,b.org_name FDeptName
      ,FOperator
      ,FDate
      ,FMemo
  FROM dbo.LHBillFlow a
  LEFT JOIN dbo.base_orgnization b ON a.FDeptId=b.id WHERE KeyId='{0}' and a.FCompanyId={1}", lblKeyId.Text, CurrentUser.AccountComId));

            //绑定数据源
            Grid3.DataSource = dataFlow;
            Grid3.DataBind();
            //----------------------------------------------------------

            var log = SqlService.Where(string.Format(@"SELECT * FROM dbo.vm_SalesDetailsLog a WHERE keyId='{0}' and FCompanyId={1}", lblKeyId.Text, CurrentUser.AccountComId));

            //绑定数据源
            Grid4.DataSource = log;
            Grid4.DataBind();
        }
예제 #2
0
        private void BindGrid()
        {
            using (var appdb = new AppContext())
            {
                DateTime now = DateTime.Now;
                DateTime d1  = new DateTime(now.Year, now.Month, 1);
                DateTime d2  = d1.AddDays(-1);
                //d1是本月的第一天,d2本月的最后一天,
                DateTime dtstart = datePickerFrom.SelectedDate == null ? d2 : datePickerFrom.SelectedDate.Value;
                DateTime dtend   = datePickerTo.SelectedDate == null?now.AddDays(2) : datePickerTo.SelectedDate.Value.AddDays(1);



                var qqq = from a in appdb.v_proqtl select a;

                //var qqq = from a in appdb.orderheader
                //          from d in appdb.orderdetail
                //          join e in appdb.bombase on d.SN equals e.OdtSN into e_join
                //          from f in e_join.DefaultIfEmpty()
                //          join b in appdb.v_userinfor on a.Inputer equals b.userid into userjoin
                //          from c in userjoin.DefaultIfEmpty()
                //          where d.FSN==a.SN
                //          select new { a.SN, a.OrderNo, a.ClientOrderNo, a.LotNo, a.ClientCode, a.RecOrderPerson, a.RecOrderDate, a.CheckDate, a.OutGoodsDate, a.ContainerType, a.Inputer, a.InputerDate, a.IsCheck, c.ChineseName, a.IsBom, a.OrderType,d.ItemNo,d.ItemName,d.Quantity,f.InputeDate };

                //在产品名称中搜索
                string searchText = ttbSearchMessage.Text;
                if (!String.IsNullOrEmpty(searchText))
                {
                    qqq = qqq.Where(u => u.OrderNo.Contains(searchText) || u.ItemNo.Contains(searchText) || u.ItemName.Contains(searchText));
                }
                //searchText为空或者选择“全部”,则列出全部
                else
                {
                }
                qqq = qqq.Where(u => u.RecOrderDate >= dtstart && u.RecOrderDate <= dtend);
                if (rbtIsQT.SelectedValue != "")
                {
                    if (rbtIsQT.SelectedValue == "0")
                    {
                        qqq = qqq.Where(u => u.qtl < 100);
                    }
                    else
                    {
                        qqq = qqq.Where(u => u.qtl >= 100);
                    }
                }
                //foreach (DictionaryEntry de in htClickColsName)
                //{
                //    switch (de.Key.ToString())
                //    {
                //        case "OrderNo":
                //            qqq = qqq.Where(u => u.OrderNo == de.Value.ToString());
                //            break;
                //        //case "OrderType":
                //        //    qqq = qqq.Where(u => u.OrderType == de.Value.ToString());
                //        //    break;
                //        //case "ClientOrderNo":
                //        //    qqq = qqq.Where(u => u.ClientOrderNo == de.Value.ToString());
                //        //    break;

                //        case "RecOrderDate":
                //            qqq = qqq.Where(u => u.RecOrderDate.ToString() == de.Value.ToString());
                //            break;
                //        //case "CheckDate":
                //        //    qqq = qqq.Where(u => u.CheckDate.ToString() == de.Value.ToString());
                //        //    break;
                //        //case "OutGoodsDate":
                //        //    qqq = qqq.Where(u => u.OutGoodsDate.ToString() == de.Value.ToString());
                //        //    break;
                //        //case "ContainerType":
                //        //    qqq = qqq.Where(u => u.ContainerType.ToString() == de.Value.ToString());
                //        //    break;
                //        //case "ChineseName":
                //        //    qqq = qqq.Where(u => u.ChineseName.ToString() == de.Value.ToString());
                //        //    break;
                //        //case "InputerDate":
                //        //    DateTime dt = DateTime.Parse(de.Value.ToString());
                //        //    qqq = qqq.Where(u => u.InputerDate == dt);
                //        //    break;
                //        //case "IsCheck":
                //        //    qqq = qqq.Where(u => u.IsCheck.ToString() == de.Value.ToString());
                //        //    break;
                //    }
                //}

                // 在查询添加之后,排序和分页之前获取总记录数
                Grid1.RecordCount = qqq.Count();// q.Count();

                // 排列和数据库分页
                qqq = SortAndPage(qqq, Grid1);

                Grid1.DataSource = qqq;// itemq.Take(2);// q;
                Grid1.DataBind();
            }
        }
예제 #3
0
 public void OnNeedRebind(object sender, EventArgs oArgs)
 {
     Grid1.DataBind();
 }
예제 #4
0
        private void BindGrid()
        {
            using (var appdb = new AppContext())
            {
                DateTime now = DateTime.Now;
                DateTime d1  = new DateTime(now.Year, now.Month, 1);
                DateTime d2  = d1.AddDays(-1);
                //d1是本月的第一天,d2本月的最后一天,
                DateTime dtstart = datePickerFrom.SelectedDate == null ? d2 : datePickerFrom.SelectedDate.Value;
                DateTime dtend   = datePickerTo.SelectedDate == null?now.AddDays(2) : datePickerTo.SelectedDate.Value.AddDays(1);

                var q = from a in appdb.sendoutprocessheader
                        select a;

                //在产品名称中搜索
                string searchText = ttbSearchMessage.Text;
                if (!String.IsNullOrEmpty(searchText))
                {
                    q = q.Where(u => u.SendOutOrderNo.Contains(searchText) || u.SendOutPlanNo.Contains(searchText) || u.SaleOrderNo.Contains(searchText));
                }
                //searchText为空或者选择“全部”,则列出全部
                else
                {
                }

                foreach (DictionaryEntry de in htClickColsName)
                {
                    switch (de.Key.ToString())
                    {
                    case "SaleOrderNo":
                        q = q.Where(u => u.SaleOrderNo == de.Value.ToString());
                        break;

                    case "SendOutPlanNo":
                        q = q.Where(u => u.SendOutPlanNo == de.Value.ToString());
                        break;

                    case "SendOutOrderNo":
                        q = q.Where(u => u.SendOutOrderNo == de.Value.ToString());
                        break;

                    case "SendOutDate":
                        q = q.Where(u => u.SendOutDate.Value.ToString("yyyy-MM-dd") == de.Value.ToString());
                        break;

                    case "Provider":
                        q = q.Where(u => u.Provider == de.Value.ToString());
                        break;

                    case "JBRName":
                        q = q.Where(u => u.JBRName == de.Value.ToString());
                        break;
                    }
                }


                // 在查询添加之后,排序和分页之前获取总记录数
                Grid1.RecordCount = q.Count();// q.Count();

                // 排列和数据库分页
                q = SortAndPage <SendOutProcessHeader>(q, Grid1);

                Grid1.DataSource = q;// itemq.Take(2);// q;
                Grid1.DataBind();
            }
        }
예제 #5
0
        public void TestClosureInjection()
        {
            var res = Grid1.Compute().Broadcast(new InjectionClosure(), 1);

            Assert.AreEqual(Grid1.Cluster.Nodes().Count, res.Sum());
        }
예제 #6
0
        //protected void bind()
        //{
        //    SqlConnection myConn = new SqlConnection();
        //    myConn.ConnectionString = "Data Source=114.115.220.70;Initial Catalog=SZ_sbgl4z;User ID=sa;Password=Bitsoft123;Integrated Security=false;Connect Timeout=30";
        //    myConn.Open();
        //    string sqlStr = "select * from X_资产报修流程表";
        //    SqlDataAdapter myDa = new SqlDataAdapter(sqlStr, myConn);
        //    DataSet myDs = new DataSet();
        //    myDa.Fill(myDs);
        //    Grid1.DataSource = myDs;

        //    Grid1.DataBind();
        //    myDa.Dispose();
        //    myDs.Dispose();
        //    myConn.Close();
        //}
        protected void Button2_Click(object sender, EventArgs e)
        {
            SchoolX_资产报修流程表 model = new SchoolX_资产报修流程表();

            if (Grid2.Rows.Count == 0)
            {
                Alert.ShowInTop("请先添加资产!", "提示信息", MessageBoxIcon.Warning);
                return;
            }
            DateTime dtime = DateTime.Now;
            string   sj    = dtime.Year + "-" + dtime.Month + "-" + dtime.Day;

            //获取报修时间参数
            if (报修时间2.EmptyText != null && 报修时间2.Text == "")
            {
                报修时间2.Text = 报修时间2.EmptyText;
            }
            if (报修时间2.Text.ToString() != null && 报修时间2.Text.ToString() != "")
            {
                DateTime date = DateTime.Parse(报修时间2.Text);

                string Y          = date.Year.ToString();  //年
                string M          = date.Month.ToString(); //月
                string D          = date.Day.ToString();   //日
                string h          = Y + "-" + M + "-" + D; //拼接年月日
                string di         = 报修地址.SelectedText;     //获取选中的一级地点
                string fang       = 房间1.SelectedText;      //获取选中的二级地点
                int[]  selections = Grid4.SelectedRowIndexArray;
                model.设备ID = "";
                foreach (int rowIndex in selections)
                {
                    int    ID  = Convert.ToInt32(Grid4.DataKeys[rowIndex][0]);
                    string xxx = Grid4.DataKeys[rowIndex][0].ToString();
                    string ss  = xxx;

                    model.设备ID += ID.ToString() + ",";

                    //sb.AppendFormat("行号:{0} 用户名:{1}<br />", rowIndex + 1, Grid1.DataKeys[rowIndex][1]);
                }


                if (报修人.Text != "" && 联系电话.Text != "" && h != "" && 报修单号.Text != "" && di != "")
                {
                    //判断二级地点是否为空
                    if (房间1.SelectedText == "" || 房间1.SelectedText == null)
                    {
                        model.报修地址 = di;
                    }
                    else
                    {
                        string F1 = "—" + fang;
                        model.报修地址 = di + F1;
                    }
                    if (报修地址.Text == "全部")
                    {
                        Alert.ShowInTop("请选择报修地址!");
                        return;
                    }
                    model.流程状态 = "待派单";
                    model.报修单号 = 报修单号.Text;
                    model.报修人  = 报修人.Text;
                    model.报修时间 = 报修时间2.Text;
                    model.故障描述 = 故障描述.Text;
                    string fileName = filePhoto.ShortFileName;

                    fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
                    fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
                    filePhoto.SaveAs(Server.MapPath("~/upload/" + fileName));
                    imgPhoto.ImageUrl = "~/upload/" + fileName;
                    model.故障照片        = "~/upload/" + fileName;
                    model.报修人电话       = 联系电话.Text;
                    //model.报修单号

                    AM_提醒通知 ammodel = new AM_提醒通知();
                    OffSession();
                    ammodel.发起时间 = DateTime.Now;
                    ammodel.是否已读 = "否";
                    ammodel.通知类型 = "待办事项通知";
                    ammodel.通知职务 = "资产管理员";
                    ammodel.发起人  = Session["姓名"].ToString();
                    ammodel.消息内容 = "您来自" + ammodel.发起人 + "的资产报修申请,请及时处理!";
                    ammodel.消息事项 = "资产报修";
                    ammodel.是否已读 = "否";
                    AM_待办业务 dbmodel = new AM_待办业务();
                    dbmodel.处理职务     = "资产管理员";
                    dbmodel.处理方式     = "职务";
                    dbmodel.FlowName = "资产报修";
                    dbmodel.Sort     = 1;
                    dbmodel.流程状态     = model.流程状态;
                    dbmodel.事项名称     = "资产报修";
                    dbmodel.发起人      = Session["姓名"].ToString();
                    dbmodel.通知内容     = "您来自" + dbmodel.发起人 + "的资产报修申请,请及时处理!";
                    dbmodel.发起时间     = DateTime.Now.ToLongDateString();

                    int xx = bll.添加资产报修表(model, ammodel, dbmodel);
                    if (xx > 0)
                    {
                        Alert.ShowInTop("提交成功!", "提示信息", MessageBoxIcon.Information);
                        Window1.Hidden = true;
                        DataSet   ds     = bll.首页_X_资产报修流程表("全部");
                        DataTable dt     = ds.Tables[0].Copy();//复制一份table
                        DataTable source = dt;

                        //绑定到Grid
                        Grid1.DataSource = dt;//DataTable
                        Grid1.DataBind();

                        return;
                    }
                    else
                    {
                        Alert.ShowInTop("添加失败!", "提示信息", MessageBoxIcon.Warning);
                        return;
                    }

                    //   string sql="insert into dbo.X_资产报修成表 流程状态,报修单号,报修人,报修时间,报修地址,故障描述,维修人员,完工时间,结果反馈 values(1,'"+报修单号.Text+"','"+报修人.Text+"','"+h+"','"+fang+"','"+故障描述.Text+"')";
                }
                else
                {
                    Alert.ShowInTop("请填写完整信息!", "提示信息", MessageBoxIcon.Warning);
                    return;
                }
            }
            else
            {
                Alert.ShowInTop("请填写完整信息!", "提示信息", MessageBoxIcon.Warning);
                return;
            }
        }
예제 #7
0
        private void ModifiedGrid()
        {
            //编辑行事件
            var dictModified = Grid1.GetModifiedDict();

            foreach (var rowKey in dictModified.Keys)
            {
                int datakey = Convert.ToInt32(Grid1.DataKeys[rowKey][1].ToString());

                var sKeys   = new StringBuilder();
                var sValues = new StringBuilder();
                foreach (var key in dictModified[rowKey].Keys)
                {
                    sKeys.AppendFormat("{0},", key);
                }

                foreach (var dictValue in dictModified[rowKey].Values)
                {
                    sValues.AppendFormat("{0},", dictValue);
                }

                var details = StockOutDetailsService.Where(p => p.FId == datakey).FirstOrDefault();
                //写入原始,通过存储过程完成明细复制
                var parmsLog = new Dictionary <string, object>();
                parmsLog.Clear();

                parmsLog.Add("@fid", datakey);
                parmsLog.Add("@opr", CurrentUser.AccountName);
                parmsLog.Add("@companyId", CurrentUser.AccountComId);
                SqlService.ExecuteProcedureCommand("proc_StockOutDetails_Log", parmsLog);

                var keys   = sKeys.ToString().Split(',');
                var values = sValues.ToString().Split(',');
                for (int i = 0; i < keys.Count(); i++)
                {
                    #region 修改内容

                    var key   = keys[i];
                    var value = values[i];

                    if (!string.IsNullOrEmpty(key))
                    {
                        if (details != null)
                        {
                            if (key.Equals("FPrice"))
                            {
                                details.FPrice  = Convert.ToDecimal(value);
                                details.FAmount = details.FPrice * details.FQty;
                            }

                            if (key.Equals("FQty"))
                            {
                                details.FQty       = Convert.ToDecimal(value);
                                details.FBottleQty = Convert.ToInt32(details.FQty);
                                details.FAmount    = details.FPrice * details.FQty;
                            }

                            if (key.Equals("FBottle"))
                            {
                                details.FBottle = value;
                            }

                            if (key.Equals("FBottleName"))
                            {
                                details.FBottle = value;
                            }

                            if (key.Equals("FRecycleQty"))
                            {
                                details.FRecycleQty = Convert.ToInt32(value);
                                //写入回空单
                            }

                            if (key.Equals("FBottleQty"))
                            {
                                //details.FBottleQty = Convert.ToInt32(value);

                                int result = 0;
                                int.TryParse(value, out result);

                                details.FBottleQty = result;
                            }

                            if (key.Equals("FMemo"))
                            {
                                details.FMemo = value;
                            }

                            var detailslog = new LHStockOutDetails_Log
                            {
                                FUpdateBy     = CurrentUser.AccountName,
                                FUpdateDate   = DateTime.Now,
                                FItemCode     = details.FItemCode,
                                FPrice        = details.FPrice,
                                FQty          = details.FQty,
                                FAmount       = details.FAmount,
                                FBottleQty    = details.FBottleQty,
                                FBottleOweQty = details.FBottleOweQty,
                                KeyId         = details.KeyId,
                                FBottle       = details.FBottle,
                                FCompanyId    = CurrentUser.AccountComId,
                                FRecycleQty   = details.FRecycleQty,
                                FStatus       = "变更",
                                FMemo         = string.Format(@"时间:{0} 变更人:{1}", DateTime.Now, CurrentUser.AccountName)
                            };

                            StockOutDetailsLogService.Add(detailslog);
                        }
                    }

                    #endregion
                }



                StockOutDetailsService.SaveChanges();
            }
        }
예제 #8
0
        private void BindGrid()
        {
            int itemTypeId       = int.Parse(ViewState["ItemType"].ToString());
            int paperId          = int.Parse(ViewState["PaperId"].ToString());
            int startRow         = int.Parse(ViewState["StartRow"].ToString());
            int endRow           = int.Parse(ViewState["EndRow"].ToString());
            int nItemcount       = 0;
            int itemDifficultyId = -1;
            int itemScore        = -1;
            int usageId          = -1;

            if (divquery.Visible)
            {
                if (this.txtScore.Text != "")
                {
                    itemScore = int.Parse(txtScore.Text);
                }

                if (ddlItemDifficulty.SelectedValue != "")
                {
                    itemDifficultyId = int.Parse(ddlItemDifficulty.SelectedValue);
                }

                usageId = int.Parse(ddlUsage.SelectedValue);
            }


            IList <RailExam.Model.Item> Items = null;
            ItemBLL itemBll = new ItemBLL();

            string knowledgeIdPath = "null";
            int    bookId          = -1;
            int    chapterId       = -1;
            string trainTypeIdPath = "null";
            string categoryIdPath  = "null";

            if (hftype.Value == "1")
            {
                knowledgeIdPath = tvView.SelectedNode.Value;
            }
            if (hftype.Value == "4")
            {
                trainTypeIdPath = tvView.SelectedNode.Value;
            }
            if (hftype.Value == "5")
            {
                categoryIdPath = tvView.SelectedNode.Value;
            }
            if (hftype.Value == "2")
            {
                bookId = int.Parse(tvView.SelectedNode.Value);
            }
            if (hftype.Value == "3")
            {
                chapterId = int.Parse(tvView.SelectedNode.Value);
            }

            Items = itemBll.GetItems(knowledgeIdPath, bookId, chapterId, trainTypeIdPath, categoryIdPath,
                                     itemTypeId, paperId, itemDifficultyId, itemScore,
                                     1, usageId, startRow, endRow, ref nItemcount);

            if (Items.Count > 0)
            {
                Grid1.VirtualItemCount = nItemcount;
                Grid1.DataSource       = Items;
                Grid1.DataBind();
            }
            else
            {
                BindEmptyGrid();
            }
        }
예제 #9
0
 private void Inits()
 {
     btnDeleteSelected.OnClientClick = Grid1.GetNoSelectionAlertInParentReference("请至少应该选择一项记录!");
     btnDeleteSelected.ConfirmText   = String.Format("确定要删除选中的<span class=\"highlight\"><script>{0}</script></span>项记录吗?", Grid1.GetSelectedCountReference());
     btnDeleteSelected.ConfirmTarget = FineUIPro.Target.Top;
     btnEnableUsers.OnClientClick    = Grid1.GetNoSelectionAlertInParentReference("请至少应该选择一项记录!");
     btnEnableUsers.ConfirmText      = String.Format("确定要启用选中的<span class=\"highlight\"><script>{0}</script></span>项记录吗?", Grid1.GetSelectedCountReference());
     btnEnableUsers.ConfirmTarget    = FineUIPro.Target.Top;
     btnDisableUsers.OnClientClick   = Grid1.GetNoSelectionAlertInParentReference("请至少应该选择一项记录!");
     btnDisableUsers.ConfirmText     = String.Format("确定要停用选中的<span class=\"highlight\"><script>{0}</script></span>项记录吗?", Grid1.GetSelectedCountReference());
     btnDisableUsers.ConfirmTarget   = FineUIPro.Target.Top;
 }
예제 #10
0
        /// <summary>
        /// 加载页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
                this.ProjectId = this.CurrUser.LoginProjectId;
                this.InitDropDownList();
                this.CheckSpecialId = Request.Params["CheckSpecialId"];
                var checkSpecial = Check_CheckSpecialService.GetCheckSpecialByCheckSpecialId(this.CheckSpecialId);
                if (checkSpecial != null)
                {
                    this.ProjectId = checkSpecial.ProjectId;
                    if (this.ProjectId != this.CurrUser.LoginProjectId)
                    {
                        this.InitDropDownList();
                    }
                    this.txtCheckSpecialCode.Text = CodeRecordsService.ReturnCodeByDataId(this.CheckSpecialId);
                    if (checkSpecial.CheckTime != null)
                    {
                        this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", checkSpecial.CheckTime);
                    }
                    this.txtPartInPersonNames.Text = checkSpecial.PartInPersonNames;
                    if (!string.IsNullOrEmpty(checkSpecial.CheckItemSetId))
                    {
                        this.drpSupCheckItemSet.SelectedValue = checkSpecial.CheckItemSetId;
                        this.getCheckItemDrp();
                    }
                    if (!string.IsNullOrEmpty(checkSpecial.PartInPersonIds))
                    {
                        this.drpPartInPersons.SelectedValueArray = checkSpecial.PartInPersonIds.Split(',');
                    }
                    checkSpecialDetails = (from x in Funs.DB.View_CheckSpecialDetail
                                           where x.CheckSpecialId == this.CheckSpecialId
                                           orderby x.CheckItem
                                           select x).ToList();
                    if (checkSpecialDetails.Count() > 0)
                    {
                        this.drpSupCheckItemSet.Readonly = true;
                    }
                }
                else
                {
                    ////自动生成编码
                    this.txtCheckSpecialCode.Text         = CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectCheckSpecialMenuId, this.ProjectId, this.CurrUser.UnitId);
                    this.txtCheckDate.Text                = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
                    this.drpSupCheckItemSet.SelectedIndex = 0;
                    this.drpSupCheckItemSet.SelectedIndex = 0;
                }

                // 删除选中单元格的客户端脚本
                string deleteScript = GetDeleteScript();
                // 新增数据初始值
                JObject defaultObj = new JObject
                {
                    { "WorkArea", "" },
                    { "UnitName", "" },
                    { "Unqualified", "" },
                    { "CheckContent", "" },
                    { "CompleteStatusName", "" },
                    { "HandleStepStr", "" },
                    { "HandleStep", "" },
                    { "UnitId", "" },
                    { "Delete", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", deleteScript, IconHelper.GetResolvedIconUrl(Icon.Delete)) }
                };
                // 在第一行新增一条数据
                btnNew.OnClientClick = Grid1.GetAddNewRecordReference(defaultObj, false);
                // 删除选中行按钮
                //btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!") + deleteScript;

                Grid1.DataSource = checkSpecialDetails;
                Grid1.DataBind();
            }
        }
예제 #11
0
 private void UIElement_OnMouseDown(object sender, MouseButtonEventArgs e)
 {
     // Workaround to support updating the TextBox when clicking outside
     Grid1.Focus();
 }
예제 #12
0
        /// <summary>
        ///  保存明细项
        /// </summary>
        private void SaveDetail(string type, Model.Check_CheckSpecial checkSpecial)
        {
            List <Model.Check_CheckSpecialDetail> detailLists = new List <Model.Check_CheckSpecialDetail>();
            JArray teamGroupData = Grid1.GetMergedData();

            foreach (JObject teamGroupRow in teamGroupData)
            {
                JObject values = teamGroupRow.Value <JObject>("values");
                Model.Check_CheckSpecialDetail newDetail = new Model.Check_CheckSpecialDetail
                {
                    CheckSpecialDetailId = SQLHelper.GetNewID(),
                    CheckSpecialId       = this.CheckSpecialId,
                    CheckContent         = values.Value <string>("CheckItemName"),
                    Unqualified          = values.Value <string>("Unqualified"),
                    WorkArea             = values.Value <string>("WorkArea"),
                };
                var getUnit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == values.Value <string>("UnitName"));
                if (getUnit != null)
                {
                    newDetail.UnitId = getUnit.UnitId;
                }
                var getHandleStep = Funs.DB.Sys_Const.FirstOrDefault(x => x.GroupId == ConstValue.Group_HandleStep && x.ConstText == values.Value <string>("HandleStepStr"));
                if (getHandleStep != null)
                {
                    newDetail.HandleStep = getHandleStep.ConstValue;
                }
                if (values.Value <string>("CompleteStatusName") == "已整改")
                {
                    newDetail.CompleteStatus = true;
                    newDetail.CompletedDate  = DateTime.Now;
                }
                else
                {
                    newDetail.CompleteStatus = false;
                }
                var getCheckItem = Funs.DB.Technique_CheckItemSet.FirstOrDefault(x => x.SupCheckItem == this.drpSupCheckItemSet.SelectedValue && x.CheckItemName == newDetail.CheckContent);
                if (getCheckItem != null)
                {
                    newDetail.CheckItem = getCheckItem.CheckItemSetId;
                }
                Check_CheckSpecialDetailService.AddCheckSpecialDetail(newDetail);
                if (type == Const.BtnSubmit)
                {
                    if (newDetail.CompleteStatus == false)
                    {
                        detailLists.Add(newDetail);
                    }
                }
            }

            if (detailLists.Count() > 0)
            {
                ////隐患整改单
                var getDetail1 = detailLists.Where(x => x.HandleStep == "1");
                if (getDetail1.Count() > 0)
                {
                    var getUnitList = getDetail1.Select(x => x.UnitId).Distinct();
                    foreach (var unitItem in getUnitList)
                    {
                        Model.RectifyNoticesItem rectifyNotices = new Model.RectifyNoticesItem
                        {
                            ProjectId     = checkSpecial.ProjectId,
                            UnitId        = unitItem,
                            CompleteManId = this.CurrUser.UserId,
                            CheckManNames = checkSpecial.PartInPersons,
                            CheckManIds   = checkSpecial.PartInPersonIds,
                            CheckedDate   = string.Format("{0:yyyy-MM-dd HH:mm:ss}", checkSpecial.CheckTime),
                            States        = Const.State_0,
                        };
                        rectifyNotices.RectifyNoticesItemItem = new List <Model.RectifyNoticesItemItem>();
                        var getUnitDItem = getDetail1.Where(x => x.UnitId == unitItem);
                        foreach (var item in getUnitDItem)
                        {
                            Model.RectifyNoticesItemItem newRItem = new Model.RectifyNoticesItemItem();
                            if (!string.IsNullOrEmpty(item.WorkArea))
                            {
                                newRItem.WrongContent = item.WorkArea + item.Unqualified;
                            }
                            else
                            {
                                newRItem.WrongContent = item.Unqualified;
                            }
                            if (string.IsNullOrEmpty(rectifyNotices.CheckSpecialDetailId))
                            {
                                rectifyNotices.CheckSpecialDetailId = item.CheckSpecialDetailId;
                            }
                            else
                            {
                                rectifyNotices.CheckSpecialDetailId += "," + item.CheckSpecialDetailId;
                            }
                            var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == item.CheckSpecialDetailId);
                            if (getAtt != null && !string.IsNullOrEmpty(getAtt.AttachUrl))
                            {
                                newRItem.PhotoBeforeUrl = getAtt.AttachUrl;
                            }

                            rectifyNotices.RectifyNoticesItemItem.Add(newRItem);
                        }

                        APIRectifyNoticesService.SaveRectifyNotices(rectifyNotices);
                    }
                }
                ///处罚单
                var getDetail2 = detailLists.Where(x => x.HandleStep == "2");
                if (getDetail2.Count() > 0)
                {
                    var getUnitList = getDetail2.Select(x => x.UnitId).Distinct();
                    foreach (var unitItem in getUnitList)
                    {
                        Model.PunishNoticeItem punishNotice = new Model.PunishNoticeItem
                        {
                            ProjectId        = checkSpecial.ProjectId,
                            PunishNoticeDate = string.Format("{0:yyyy-MM-dd HH:mm:ss}", checkSpecial.CheckTime),
                            UnitId           = unitItem,
                            CompileManId     = this.CurrUser.UserId,
                            PunishStates     = Const.State_0,
                        };

                        var getUnitDItem = getDetail2.Where(x => x.UnitId == unitItem);
                        foreach (var item in getUnitDItem)
                        {
                            Model.RectifyNoticesItemItem newRItem = new Model.RectifyNoticesItemItem();
                            punishNotice.IncentiveReason += item.Unqualified;
                            if (string.IsNullOrEmpty(punishNotice.CheckSpecialDetailId))
                            {
                                punishNotice.CheckSpecialDetailId = item.CheckSpecialDetailId;
                            }
                            else
                            {
                                punishNotice.CheckSpecialDetailId += "," + item.CheckSpecialDetailId;
                            }
                            var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == item.CheckSpecialDetailId);
                            if (getAtt != null && !string.IsNullOrEmpty(getAtt.AttachUrl))
                            {
                                punishNotice.PunishUrl = getAtt.AttachUrl;
                            }
                        }

                        APIPunishNoticeService.SavePunishNotice(punishNotice);
                    }
                }
                ///暂停令
                var getDetail3 = detailLists.Where(x => x.HandleStep == "3");
                if (getDetail3.Count() > 0)
                {
                    var getUnitList = getDetail3.Select(x => x.UnitId).Distinct();
                    foreach (var unitItem in getUnitList)
                    {
                        Model.PauseNoticeItem pauseNotice = new Model.PauseNoticeItem
                        {
                            ProjectId   = checkSpecial.ProjectId,
                            UnitId      = unitItem,
                            PauseTime   = string.Format("{0:yyyy-MM-dd HH:mm:ss}", checkSpecial.CheckTime),
                            PauseStates = Const.State_0,
                        };

                        var getUnitDItem = getDetail3.Where(x => x.UnitId == unitItem);
                        foreach (var item in getUnitDItem)
                        {
                            Model.RectifyNoticesItemItem newRItem = new Model.RectifyNoticesItemItem();
                            pauseNotice.ThirdContent += item.Unqualified;
                            if (string.IsNullOrEmpty(pauseNotice.ProjectPlace))
                            {
                                pauseNotice.ProjectPlace = item.WorkArea;
                            }
                            else
                            {
                                if (!pauseNotice.ProjectPlace.Contains(item.WorkArea))
                                {
                                    pauseNotice.ProjectPlace += "," + item.WorkArea;
                                }
                            }
                            if (string.IsNullOrEmpty(pauseNotice.CheckSpecialDetailId))
                            {
                                pauseNotice.CheckSpecialDetailId = item.CheckSpecialDetailId;
                            }
                            else
                            {
                                pauseNotice.CheckSpecialDetailId += "," + item.CheckSpecialDetailId;
                            }
                            var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == item.CheckSpecialDetailId);
                            if (getAtt != null && !string.IsNullOrEmpty(getAtt.AttachUrl))
                            {
                                pauseNotice.PauseNoticeAttachUrl = getAtt.AttachUrl;
                            }
                        }

                        APIPauseNoticeService.SavePauseNotice(pauseNotice);
                    }
                }
            }
        }
예제 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // 删除选中单元格的客户端脚本
                string deleteScript = GetDeleteScript(Grid1);

                // 新增数据初始值
                JObject defaultObj = new JObject();
                defaultObj.Add("Name", "新用户");
                defaultObj.Add("Gender", "1");
                defaultObj.Add("Major", "化学系");
                defaultObj.Add("ChineseScore", 0);
                defaultObj.Add("MathScore", 0);
                defaultObj.Add("TotalScore", 0);
                defaultObj.Add("Delete", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", deleteScript, IconHelper.GetResolvedIconUrl(Icon.Delete)));

                // 在第一行新增一条数据
                btnNew.OnClientClick = Grid1.GetAddNewRecordReference(defaultObj, AppendToEnd);

                // 重置表格
                btnReset.OnClientClick = Confirm.GetShowReference("确定要重置表格数据?", String.Empty, Grid1.GetRejectChangesReference(), String.Empty);


                // 删除选中行按钮
                btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!") + deleteScript;


                // 绑定表格
                BindGrid();
            }
        }
예제 #14
0
        private void bind()
        {
            Grid1.PageSize = int.Parse(ddlPageSize.SelectedValue);
            string        Company    = Company_Name.SelectedValue;
            DateTime      dtime      = DateTime.Now;
            int           a          = Convert.ToInt32(dtime.ToString("yyyy"));
            int           b          = a - 2015;
            int           c          = 0;
            int           lastyear   = a - 1;
            string        OrderbyStr = "LEN" + "(" + Grid1.SortField + ")" + " " + Grid1.SortDirection + "," + Grid1.SortField + " " + Grid1.SortDirection;
            StringBuilder Tiaojian1  = new StringBuilder();
            StringBuilder Tiaojian2  = new StringBuilder();
            StringBuilder Tiaojian3  = new StringBuilder();
            StringBuilder Tiaojian4  = new StringBuilder();
            StringBuilder Tiaojian5  = new StringBuilder();
            StringBuilder Tiaojian6  = new StringBuilder();
            StringBuilder Tiaojian7  = new StringBuilder();
            StringBuilder Tiaojian8  = new StringBuilder();

            Tiaojian8.AppendFormat("case when bc.y{0}>bc.y{1} THEN bc.y{0}*bc.newPrice ELSE bc.y{1}*bc.newPrice END AS 新总价,case when bc.y{0} > bc.y{1} THEN bc.y{0} ELSE bc.y{1} END AS 新数量", lastyear, a);

            string SpareNumContent  = Spare_PartNum.Text.ToString();
            string SpareNameContent = Spare_PartName.Text.ToString();

            StringBuilder SpareNumsb  = new StringBuilder();
            StringBuilder SpareNamesb = new StringBuilder();

            if (string.IsNullOrEmpty(SpareNumContent))
            {
                SpareNumsb.Append(" ");
            }
            else
            {
                SpareNumsb.AppendFormat("AND a.物料号 like '%{0}%'", SpareNumContent);
            }


            if (string.IsNullOrEmpty(SpareNameContent))
            {
                SpareNamesb.Append(" ");
            }
            else
            {
                SpareNamesb.AppendFormat("AND c.备件名称 like '%{0}%'", SpareNameContent);
            }


            string mohuContent_SpareNum  = SpareNumsb.ToString();
            string mohuContent_SpareName = SpareNamesb.ToString();

            int year = 0;

            for (int k = 0; k <= b; k++)
            {
                if (k == b)
                {
                    year = 2015 + k;
                    Tiaojian1.AppendFormat("{0}", "y" + year);
                    Tiaojian2.AppendFormat("ISNULL(sum(sa.{0}),0)", "y" + year);
                    Tiaojian3.AppendFormat("py.{0} as price{1}", "y" + year, year);
                    Tiaojian4.AppendFormat("ISNULL(sum(sa.{0}),0) as {0}", "y" + year);
                    Tiaojian5.AppendFormat("ypc.{0}", "price" + year);
                    Tiaojian6.AppendFormat("sum(ypc.price{0}) as {1}", year, "price" + year);
                    Tiaojian7.AppendFormat("ISNULL(sum(ypc.price{0}),0)", year);
                }
                else
                {
                    year = 2015 + k;
                    Tiaojian1.AppendFormat("{0},", "y" + year);
                    Tiaojian2.AppendFormat("ISNULL(sum(sa.{0}),0)+", "y" + year);
                    Tiaojian3.AppendFormat("py.{0} as price{1},", "y" + year, year);
                    Tiaojian4.AppendFormat("ISNULL(sum(sa.{0}),0) as {0},", "y" + year);
                    Tiaojian5.AppendFormat("ypc.{0},", "price" + year);
                    Tiaojian6.AppendFormat("sum(ypc.price{0}) as {1},", year, "price" + year);
                    Tiaojian7.AppendFormat("ISNULL(sum(ypc.price{0}),0)+", year);
                }
            }
            string StrWhere1 = Tiaojian1.ToString();
            string StrWhere2 = Tiaojian2.ToString();
            string StrWhere3 = Tiaojian3.ToString();
            string StrWhere4 = Tiaojian4.ToString();
            string StrWhere5 = Tiaojian5.ToString();
            string StrWhere6 = Tiaojian6.ToString();
            string StrWhere7 = Tiaojian7.ToString();
            string StrWhere8 = Tiaojian8.ToString();

            string Sql = @"WITH mytabCte AS (
         SELECT SUM(b.操作数量)  AS 总操作数量,
                a.价格,
                'y' + CONVERT(VARCHAR(50), YEAR(b.操作日期)) AS 年份,
                a.物料号,
                a.提报单位,
                c.备件名称,
                (
                    SELECT TOP 1 c.价格
                    FROM   b_备件_导入日志表 AS c
                    WHERE  c.物料号 = a.物料号
                    ORDER BY
                           c.[发料日期] DESC
                )            AS newPrice
         FROM   b_备件_导入日志表      a,
                b_备件_记录表        b,
                b_备件_信息表        c
         WHERE  a.ID = b.日志ID AND  a.物料号=c.物料号 " + mohuContent_SpareNum + @" " + mohuContent_SpareName + @"
                AND a.提报单位 = '" + Company + @"'
                AND YEAR(b.操作日期) > 2014
         GROUP BY
                YEAR(b.操作日期),
                a.物料号,
                a.价格,
                a.提报单位,
                c.备件名称
     ),
     cte AS (
         SELECT YEAR(b.操作日期)     yearNum,
                b.操作数量 * a.价格 价格,
                a.物料号,
                a.提报单位,
                c.备件名称
         FROM   b_备件_导入日志表       a,
                b_备件_记录表         b,
                b_备件_信息表         c
         WHERE  a.ID = b.日志ID AND  a.物料号=c.物料号 " + mohuContent_SpareNum + @" " + mohuContent_SpareName + @"
                AND a.提报单位 = '" + Company + @"'
                AND YEAR(b.操作日期) > 2014
     ),
     yearCte AS (
         SELECT SUM(价格) AS 总价格,
                'y' + CONVERT(VARCHAR(50), yearNum) AS 年份,
                物料号,
                提报单位,
                备件名称
         FROM   cte
         GROUP BY
                yearNum,
                物料号,
                提报单位,
                备件名称
     ),
     yearPIVOTCte AS (
         SELECT py.物料号,
                py.提报单位,
                py.备件名称,
                " + StrWhere3 + @"
         FROM   yearCte
                PIVOT(
                    SUM(yearCte.总价格) FOR yearCte.年份 IN (" + StrWhere1 + @")
                )         AS py
     ),
     baseCte AS (
         SELECT sa.物料号,
                sa.提报单位,
                 Convert(DECIMAL(13,2),(
                   " + StrWhere7 + @"
                ) / (
                   " + StrWhere2 + @"
                ) ) as newPrice,
                sa.备件名称,
                " + StrWhere4 + @",
                (
                   " + StrWhere2 + @"
                )                         AS 总操作数量,
                " + StrWhere6 + @",
                (
                   " + StrWhere7 + @"
                )                         AS 总价
         FROM   mytabCte
                PIVOT(
                    SUM(mytabCte.总操作数量) FOR mytabCte.年份 IN (" + StrWhere1 + @")
                )                         AS sa
                LEFT JOIN yearPIVOTCte ypc
                     ON  ypc.物料号 = sa.物料号
         GROUP BY
                sa.物料号,
                sa.newPrice,
                sa.提报单位,
                sa.备件名称
     )

SELECT bc.*," + StrWhere8 + @"
	
FROM   baseCte AS bc
ORDER BY
       " + OrderbyStr + "";



            DataSet   ds = bll.返回DataSet(Sql);
            DataTable dt = ds.Tables[0];



            Grid1.DataSource = dt;
            Grid1.DataBind();

            double donateTotal = 0.00;
            double feeTotal    = 0.00;

            foreach (DataRow row in dt.Rows)
            {
                donateTotal += Convert.ToDouble(row["总价"]);
                feeTotal    += Convert.ToDouble(row["新总价"]);
            }

            JObject summary = new JObject();

            summary.Add("总价", donateTotal.ToString("F2"));
            summary.Add("新总价", feeTotal.ToString("F2"));

            Grid1.SummaryData = summary;
        }
예제 #15
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (Grid1.GetModifiedData().Count == 0 && Grid1.GetNewAddedList().Count == 0)
                {
                    Alert.Show("表格数据没有变化!");
                    return;
                }
                ArrayList al = new ArrayList();
                string    sql = "", s = "";
                // 新增数据
                SQLHelper.DbHelperSQL.SetConnectionString("");
                List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList();
                string lastcode = "", lastname = "";
                for (int i = 0; i < newAddedList.Count; i++)
                {
                    if (lastcode == newAddedList[i]["StoreCode"].ToString() || lastname == newAddedList[i]["StoreName"].ToString())
                    {
                        Alert.Show("第" + (i + 1) + "行已经存在相同的仓库代码或仓库名称,请更改");
                        return;
                    }
                    else
                    {
                        sql = "select count(*) from StoreHouse where StoreCode='" + newAddedList[i]["StoreCode"].ToString() + "' or  StoreName='" + newAddedList[i]["StoreName"].ToString() + "'";

                        if (int.Parse(SQLHelper.DbHelperSQL.GetSingle(sql, 30)) > 0)
                        {
                            Alert.Show("第" + (i + 1) + "行已经存在相同的仓库代码或仓库名称,请更改");
                            return;
                        }
                    }
                    lastcode = newAddedList[i]["StoreCode"].ToString();
                    lastname = newAddedList[i]["StoreName"].ToString();
                    sql      = "insert into StoreHouse(StoreCode,StoreName,SortIndex) values('" + newAddedList[i]["StoreCode"].ToString() + "','" + newAddedList[i]["StoreName"].ToString() + "'," + newAddedList[i]["SortIndex"].ToString() + ")";
                    log.Info("sql add StoreHouse:" + sql);
                    al.Add(sql);
                }

                //Alert.Show(s);
                //return;
                //s = "";
                // 修改的现有数据
                Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict();

                foreach (int rowIndex in modifiedDict.Keys)
                {
                    sql = "update StoreHouse set ";
                    for (int i = 0; i < Grid1.Columns.Count; i++)
                    {
                        if (modifiedDict[rowIndex].ContainsKey(Grid1.Columns[i].ColumnID))
                        {
                            sql += Grid1.Columns[i].ColumnID + "='" + modifiedDict[rowIndex][Grid1.Columns[i].ColumnID].ToString() + "',";
                        }
                    }
                    sql  = sql.TrimEnd(new char[] { ',' });
                    sql += " where sn=" + Grid1.DataKeys[rowIndex][0];

                    al.Add(sql);
                }


                SQLHelper.DbHelperSQL.SetConnectionString("");
                if (SQLHelper.DbHelperSQL.ExecuteSqlTran(al))
                {
                    Alert.Show("保存成功");
                    BindGrid();
                }
                else
                {
                    Alert.Show("保存失败");
                }
            }
            catch (Exception ee)
            {
                Alert.Show(ee.Message);
            }
        }
예제 #16
0
 /// <summary>
 /// 加载页面
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ////权限按钮方法
         this.GetButtonPower();
         this.btnMenuDelete.ConfirmText  = String.Format("你确定要删除选中的&nbsp;<b><script>{0}</script></b>&nbsp;行数据吗?", Grid1.GetSelectedCountReference());
         ddlPageSize.SelectedValue       = Grid1.PageSize.ToString();
         this.drpCheckMan.DataTextField  = "UserName";
         this.drpCheckMan.DataValueField = "UserId";
         this.drpCheckMan.DataSource     = (from x in Funs.DB.View_Inspection_Registration
                                            join y in Funs.DB.Sys_User
                                            on x.CheckManId equals y.UserId
                                            where x.ProjectId == this.CurrUser.LoginProjectId
                                            select y).Distinct().ToList();
         this.drpCheckMan.DataBind();
         Funs.FineUIPleaseSelect(this.drpCheckMan);
         GetRecords();
         // 绑定表格
         BindGrid();
     }
 }
예제 #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataSet   ds     = bll.首页_X_资产报修流程表("全部");
                DataTable dt     = ds.Tables[0].Copy();//复制一份table
                DataTable source = dt;

                // 3.绑定到Grid
                Grid1.DataSource = dt;//DataTable
                Grid1.DataBind();
                DateTime dtime = DateTime.Now;
                string   sj    = dtime.Year + "-" + dtime.Month + "-" + dtime.Day;
                报修时间2.EmptyText       = sj;
                DatePicker1.EmptyText = sj;
                完成时间.EmptyText        = sj;
                List <School房间信息表> cfdd = bll.cfdd();
                报修地址.DataTextField  = "名称";
                报修地址.DataValueField = "ID";
                报修地址.DataSource     = cfdd;
                报修地址.DataBind();

                //DatePicker1.MinDate = DateTime.Now;
                //DatePicker1.MaxDate = DateTime.Now.AddDays(10);


                // 3.绑定到Grid
                Grid4.DataSource = dt;//DataTable
                Grid4.DataBind();
                //绑定条件
                School清查盘点BLL pdbll = new School清查盘点BLL();

                List <School一级部门表> xxmc = pdbll.查询一级部门();
                部门.DataTextField  = "名称";
                部门.DataValueField = "ID";
                部门.DataSource     = xxmc;
                部门.DataBind();

                List <School一级类别表> yjlb = pdbll.查询一级类别();
                一级.DataTextField  = "名称";
                一级.DataValueField = "ID";
                一级.DataSource     = yjlb;
                一级.DataBind();


                List <School建筑物信息表> 查询建筑物 = pdbll.查询建筑物信息表();
                存放地点.DataTextField  = "名称";
                存放地点.DataValueField = "ID";
                存放地点.DataSource     = 查询建筑物;
                存放地点.DataBind();


                二级.Enabled  = false;
                级.Enabled   = false;
                负责人.Enabled = false;
                房间.Enabled  = false;

                二级.EmptyText  = "全部";
                级.EmptyText   = "全部";
                负责人.EmptyText = "全部";
                房间.EmptyText  = "全部";
                OffSession();
                string 职务 = HttpContext.Current.Session["职务"].ToString();
                联系电话.Text = HttpContext.Current.Session["电话号码"].ToString();
                if (职务 == "资产管理员")
                {
                    Button1.Hidden = false;
                }
            }
        }
예제 #18
0
 private void BindDDL()
 {
     Grid1.DataSource = DB.Departments.OrderBy(d => d.DisplayOrder).ToList();
     Grid1.DataBind();
 }
예제 #19
0
        /// <summary>
        ///     Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //初始化控件数据
                InitData();

                //加载数据
                LoadData();
            }
            else
            {
                #region AddList
                if (GetRequestEventArgument().Contains("reloadGrid:"))
                {
                    //查找所选商品代码,查访产品集合
                    string keys = GetRequestEventArgument().Split(':')[1];

                    var values = keys.Split(',');

                    string codes = String.Empty;
                    for (int i = 0; i < values.Count(); i++)
                    {
                        codes += string.Format("'{0}',", values[i]);
                    }

                    var value = codes.Substring(0, codes.Length - 1);

                    var data = SqlService.Where(string.Format("SELECT * FROM dbo.vm_SalesItem a WHERE a.FItemCode IN ({0}) and FCompanyId={1}", value, CurrentUser.AccountComId));

                    if (data != null && data.Tables.Count > 0 && data.Tables[0].Rows.Count > 0)
                    {
                        var table = data.Tables[0];
                        for (int i = 0; i < table.Rows.Count; i++)
                        {
                            var details = new LHStockOutDetails();

                            decimal price = GasHelper.GeCustomerPrice("", //
                                                                      table.Rows[i]["FItemCode"].ToString(), CurrentUser.AccountComId);

                            details.FItemCode     = table.Rows[i]["FItemCode"].ToString();
                            details.FPrice        = price;
                            details.FQty          = 1;
                            details.FAmount       = price;
                            details.FBottleQty    = 1;
                            details.FBottleOweQty = 0;
                            details.FCompanyId    = CurrentUser.AccountComId;
                            details.KeyId         = txtKeyId.Text.Trim();
                            details.FCateId       = Convert.ToInt32(table.Rows[i]["FId"].ToString());

                            //默认包装物
                            details.FBottle = table.Rows[i]["FBottle"].ToString();

                            StockOutDetailsService.AddEntity(details);

                            //日志
                            switch (Actions)
                            {
                            case WebAction.Add:
                                break;

                            case WebAction.Edit:
                                //记录一下当前新增人操作内容
                                var detailslog = new LHStockOutDetails_Log
                                {
                                    FUpdateBy     = CurrentUser.AccountName,
                                    FUpdateDate   = DateTime.Now,
                                    FItemCode     = details.FItemCode,
                                    FPrice        = price,
                                    FQty          = 1,
                                    FAmount       = price,
                                    FBottleQty    = 1,
                                    FBottleOweQty = 0,
                                    KeyId         = txtKeyId.Text.Trim(),
                                    FBottle       = details.FBottle,
                                    FCompanyId    = CurrentUser.AccountComId,
                                    FStatus       = "新增",
                                    FMemo         = string.Format(@"时间:{0} 操作人:{1}", DateTime.Now, CurrentUser.AccountName)
                                };

                                StockOutDetailsLogService.Add(detailslog);

                                break;
                            }
                        }

                        StockOutDetailsService.SaveChanges();

                        //重新绑定值
                        BindDataGrid();
                    }
                }
                #endregion


                #region 更新合计

                if (Grid1.Rows.Count > 0)
                {
                    if (GetRequestEventArgument() == "UPDATE_SUMMARY")
                    {
                        // 页面要求重新计算合计行的值
                        OutputSummaryData();

                        //写入
                        ModifiedGrid();

                        // 为了保持前后台上传,回发更新合计行值后,必须进行数据绑定或者提交更改
                        Grid1.CommitChanges();
                    }
                }

                #endregion
            }
        }
예제 #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnAdd.OnClientClick    = windowSourceCode.GetShowReference("Add.aspx", "添加模块信息");
                btnDelete.OnClientClick = Grid1.GetNoSelectionAlertInTopReference("请至少选择一项!");
                btnDelete.ConfirmText   = String.Format("你确定要删除选中的&nbsp;<b><script>{0}</script></b>&nbsp;项吗?", Grid1.GetSelectedCountReference());

                btnApproval.OnClientClick = Grid1.GetNoSelectionAlertInTopReference("请至少选择一项!");
                btnApproval.ConfirmText   = String.Format("你确定要审核选中的&nbsp;<b><script>{0}</script></b>&nbsp;项吗?", Grid1.GetSelectedCountReference());

                BindGrid();

                ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
            }
        }
예제 #21
0
        /// <summary>
        ///     单元格编辑与修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e)
        {
            Window1.Hidden = true;
            Window2.Hidden = true;
            Window3.Hidden = true;

            //新增行事件
            var addList = Grid1.GetNewAddedList();

            foreach (var add in addList)
            {
                #region AddDetails

                var dictValues = add.Values;

                //商品代码
                var firstOrDefault = dictValues.First();

                if (firstOrDefault != null)
                {
                    DataSet dataSet = GasHelper.GetSalesItem(firstOrDefault.ToString(), CurrentUser.AccountComId);

                    DataTable table = dataSet.Tables[0];

                    if (table != null && table.Rows.Count > 0)
                    {
                        decimal price = GasHelper.GeCustomerPrice("",//
                                                                  table.Rows[0]["FItemCode"].ToString(), CurrentUser.AccountComId);

                        table.Rows[0]["FPrice"] = price;

                        var details = new LHStockOutDetails
                        {
                            FItemCode     = table.Rows[0]["FItemCode"].ToString(),
                            FPrice        = price,
                            FQty          = 1,
                            FAmount       = price,
                            FBottleQty    = 1,
                            FBottleOweQty = 0,
                            FCompanyId    = CurrentUser.AccountComId,
                            KeyId         = txtKeyId.Text.Trim(),
                            FBottle       = table.Rows[0]["FBottleCode"].ToString(),
                            FCateId       = Convert.ToInt32(table.Rows[0]["FId"].ToString())
                        };

                        switch (Actions)
                        {
                        case WebAction.Add:
                            break;

                        case WebAction.Edit:
                            //记录一下当前新增人操作内容
                            var detailslog = new LHStockOutDetails_Log
                            {
                                FUpdateBy     = CurrentUser.AccountName,
                                FUpdateDate   = DateTime.Now,
                                FItemCode     = table.Rows[0]["FItemCode"].ToString(),
                                FPrice        = price,
                                FQty          = 1,
                                FAmount       = price,
                                FBottleQty    = 1,
                                FCompanyId    = CurrentUser.AccountComId,
                                FBottleOweQty = 0,
                                KeyId         = txtKeyId.Text.Trim(),
                                FBottle       = table.Rows[0]["FBottleCode"].ToString(),
                                FStatus       = "新增",
                                FMemo         = string.Format(@"时间:{0} 新增人:{1}", DateTime.Now, CurrentUser.AccountName)
                            };

                            StockOutDetailsLogService.Add(detailslog);

                            break;
                        }


                        StockOutDetailsService.Add(details);
                    }
                }
                #endregion
            }

            ////编辑行事件
            //var dictModified = Grid1.GetModifiedDict();
            //foreach (var index in dictModified.Keys)
            //{
            //    int datakey = Convert.ToInt32(Grid1.DataKeys[index][1].ToString());

            //    foreach (var dictValue in dictModified.Values)
            //    {
            //        foreach (KeyValuePair<string, object> keyValuePair in dictValue)
            //        {
            //            string key = keyValuePair.Key;
            //            string value = keyValuePair.Value.ToString();

            //            var details = StockOutDetailsService.Where(p => p.FId == datakey&&p.FCompanyId==CurrentUser.AccountComId).FirstOrDefault();

            //            //写入原始,通过存储过程完成明细复制
            //            var parms = new Dictionary<string, object>();
            //            parms.Clear();

            //            parms.Add("@fid", datakey);
            //            parms.Add("@opr", CurrentUser.AccountName);
            //            parms.Add("@companyId", CurrentUser.AccountComId);
            //            SqlService.ExecuteProcedureCommand("proc_StockOutDetails_Log", parms);

            //            if (details != null)
            //            {
            //                switch (key)
            //                {
            //                    case "FPrice":
            //                        details.FPrice = Convert.ToDecimal(value);
            //                        details.FAmount = details.FPrice * details.FQty;
            //                        break;

            //                    case "FQty":
            //                        details.FQty = Convert.ToDecimal(value);
            //                        details.FBottleQty = Convert.ToInt32(details.FQty);
            //                        details.FAmount = details.FPrice * details.FQty;
            //                        break;

            //                    case "FBottle":
            //                        details.FBottle = value;
            //                        break;

            //                    case "FBottleName":
            //                        details.FBottle = value;
            //                        break;

            //                    case "FBottleQty":
            //                        details.FBottleQty = Convert.ToInt32(value);
            //                        break;

            //                    case "FMemo":
            //                        details.FMemo = value;
            //                        break;
            //                }

            //                var detailslog = new LHStockOutDetails_Log
            //                {
            //                    FUpdateBy = CurrentUser.AccountName,
            //                    FUpdateDate = DateTime.Now,
            //                    FItemCode = details.FItemCode,
            //                    FPrice = details.FPrice,
            //                    FQty = details.FQty,
            //                    FAmount = details.FAmount,
            //                    FBottleQty = details.FBottleQty,
            //                    FBottleOweQty = details.FBottleOweQty,
            //                    KeyId = details.KeyId,
            //                    FBottle = details.FBottle,
            //                    FCompanyId = CurrentUser.AccountComId,
            //                    FStatus = "变更",
            //                    FMemo = string.Format(@"时间:{0} 变更人:{1}", DateTime.Now, CurrentUser.AccountName)
            //                };

            //                StockOutDetailsLogService.Add(detailslog);

            //            }

            //            StockOutDetailsService.SaveChanges();
            //        }
            //    }
            //}

            if (addList.Count > 0)
            {
                BindDataGrid();
            }
        }
예제 #22
0
        protected void Grid1_PreRowDataBound(object sender, GridPreRowEventArgs e)
        {
            WindowField     lbfModify = Grid1.FindColumn("lbfModify") as WindowField;
            LinkButtonField lbfDelete = Grid1.FindColumn("lbfDelete") as LinkButtonField;

            //// 如果绑定到 DataTable,那么这里的 DataItem 就是 DataRowView
            DataRowView row = e.DataItem as DataRowView;

            if (row != null)
            {
                switch (TStar.Utility.Common.ConvertHelper.EnumParse <TStar.Web.Globals.SystemSetting.Status>(row["Ztdm"].ToString()))
                {
                case TG.SystemSetting.Status.Draft:
                case TG.SystemSetting.Status.InRewrite:
                case TG.SystemSetting.Status.InModify:
                    //case TG.SystemSetting.Status.Revoked:
                    lbfModify.Icon = FineUI.Icon.Pencil;
                    lbfDelete.Icon = FineUI.Icon.LaptopGo;
                    break;

                case TG.SystemSetting.Status.Submitted:
                    lbfModify.Icon = FineUI.Icon.None;
                    lbfDelete.Icon = FineUI.Icon.None;    //LaptopDelete;
                    break;

                case TG.SystemSetting.Status.ToBeModified:
                    lbfModify.Icon = FineUI.Icon.Pencil;
                    lbfDelete.Icon = FineUI.Icon.None;
                    break;

                case TG.SystemSetting.Status.ToBeRewritten:
                    lbfModify.Icon = FineUI.Icon.PencilAdd;
                    lbfDelete.Icon = FineUI.Icon.None;
                    break;

                default:
                    lbfModify.Icon = lbfDelete.Icon = FineUI.Icon.None;
                    break;
                }
                switch (lbfModify.Icon)
                {
                case FineUI.Icon.Pencil:
                    lbfModify.DataIFrameUrlFormatString = "SxhbEdit.aspx?pkid={0}&ztdm={1}";
                    lbfModify.Title   = "弹出窗-修改";
                    lbfModify.ToolTip = "修改";
                    break;

                case FineUI.Icon.PencilAdd:
                    lbfModify.DataIFrameUrlFormatString = "SxhbEdit.aspx?glbh={0}&ztdm={1}";
                    lbfModify.Title   = "弹出窗-重写";
                    lbfModify.ToolTip = "重写";
                    break;
                }
                switch (lbfDelete.Icon)
                {
                case FineUI.Icon.LaptopGo:
                    lbfDelete.CommandName = "Submit";
                    lbfDelete.ToolTip     = "提交";
                    lbfDelete.ConfirmText = "确认提交?";
                    break;
                    //case FineUI.Icon.LaptopDelete:
                    //    lbfDelete.CommandName = "Revoke";
                    //    lbfDelete.ToolTip = "撤回";
                    //    lbfDelete.ConfirmText = "确认撤回?";
                    //    break;
                }
            }
        }
예제 #23
0
        public void TestTaskInjection()
        {
            int res = Grid1.Compute().Execute(new InjectionTask(), 0);

            Assert.AreEqual(Grid1.Cluster.Nodes().Count, res);
        }
예제 #24
0
        public void TestTaskInjectionBinarizable()
        {
            int res = Grid1.GetCompute().Execute(new InjectionTaskBinarizable(), 0);

            Assert.AreEqual(GetServerCount(), res);
        }
예제 #25
0
        public void TestNoResultCache()
        {
            int res = Grid1.Compute().Execute(new NoResultCacheTask(), 0);

            Assert.AreEqual(Grid1.Cluster.Nodes().Count, res);
        }
예제 #26
0
        public void TestClosureInjection()
        {
            var res = Grid1.GetCompute().Broadcast(new InjectionClosure(), 1);

            Assert.AreEqual(GetServerCount(), res.Sum());
        }
예제 #27
0
 private string GetDeleteScript()
 {
     return(Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, Grid1.GetDeleteSelectedRowsReference(), String.Empty));
 }
예제 #28
0
        public void TestNoResultCache()
        {
            int res = Grid1.GetCompute().Execute(new NoResultCacheTask(), 0);

            Assert.AreEqual(GetServerCount(), res);
        }
예제 #29
0
        /// <summary>
        /// 加载页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnClose.OnClientClick = ActiveWindow.GetHideReference();

                this.CheckColligationId = Request.Params["CheckColligationId"];
                var checkColligation = BLL.Check_CheckColligationService.GetCheckColligationByCheckColligationId(this.CheckColligationId);
                if (checkColligation != null)
                {
                    this.txtCheckColligationCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.CheckColligationId);
                    if (checkColligation.CheckTime != null)
                    {
                        this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", checkColligation.CheckTime);
                    }
                    if (!string.IsNullOrEmpty(checkColligation.CheckType))
                    {
                        if (checkColligation.CheckType == "0")
                        {
                            this.txtCheckType.Text = "周检";
                        }
                        else if (checkColligation.CheckType == "1")
                        {
                            this.txtCheckType.Text = "月检";
                        }
                        else if (checkColligation.CheckType == "2")
                        {
                            this.txtCheckType.Text = "其它";
                        }
                    }
                    if (!string.IsNullOrEmpty(checkColligation.PartInUnits))
                    {
                        string   unitNames = string.Empty;
                        string[] unitIds   = checkColligation.PartInUnits.Split(',');
                        foreach (var item in unitIds)
                        {
                            string name = BLL.UnitService.GetUnitNameByUnitId(item);
                            if (!string.IsNullOrEmpty(name))
                            {
                                unitNames += name + ",";
                            }
                        }
                        if (!string.IsNullOrEmpty(unitNames))
                        {
                            unitNames = unitNames.Substring(0, unitNames.LastIndexOf(","));
                        }
                        this.txtUnit.Text = unitNames;
                    }

                    this.txtCheckPerson.Text = BLL.UserService.GetUserNameByUserId(checkColligation.CheckPerson);

                    if (!string.IsNullOrEmpty(checkColligation.PartInPersonIds))
                    {
                        string   personStr = string.Empty;
                        string[] strs      = checkColligation.PartInPersonIds.Split(',');
                        foreach (var s in strs)
                        {
                            Model.Sys_User checkPerson = BLL.UserService.GetUserByUserId(s);
                            if (checkPerson != null)
                            {
                                personStr += checkPerson.UserName + ",";
                            }
                        }
                        if (!string.IsNullOrEmpty(personStr))
                        {
                            personStr = personStr.Substring(0, personStr.LastIndexOf(","));
                        }
                        this.txtPartInPersons.Text = personStr;
                    }
                    this.txtPartInPersonNames.Text = checkColligation.PartInPersonNames;
                    //this.txtDaySummary.Text = HttpUtility.HtmlDecode(checkColligation.DaySummary);
                    checkColligationDetails = (from x in Funs.DB.View_Check_CheckColligationDetail where x.CheckColligationId == this.CheckColligationId orderby x.CheckItem select x).ToList();
                }
                Grid1.DataSource = checkColligationDetails;
                Grid1.DataBind();

                this.ctlAuditFlow.MenuId = BLL.Const.ProjectCheckColligationWHMenuId;
                this.ctlAuditFlow.DataId = this.CheckColligationId;
            }
        }
 protected void Window1_Close(object sender, EventArgs e)
 {
     //Alert.ShowInTop("弹出窗口关闭了!");
     Grid1.RefreshIFrame();
 }