public ShortCutDAL() { _commonDAL = new CommonDAL<T_PF_SHORTCUT>(); _userShortCutDAL = new CommonDAL<T_PF_USER_SHORTCUT>(); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { TwdPartBoxInfo info = dal.GetInfo(id); if (info == null) { throw new Exception("MC:0x00000084");///数据错误 } string partBoxName = CommonBLL.GetFieldValue(fields, "PART_BOX_NAME"); info.PartBoxName = partBoxName; string sZoneNo = CommonBLL.GetFieldValue(fields, "S_ZONE_NO"); string tZoneNo = CommonBLL.GetFieldValue(fields, "T_ZONE_NO"); string prevSZoneNo = info.SZoneNo; string prevTZoneNo = info.TZoneNo; info.SZoneNo = sZoneNo; info.TZoneNo = tZoneNo; string requirement_accumulate_time = CommonBLL.GetFieldValue(fields, "REQUIREMENT_ACCUMULATE_TIME"); int.TryParse(requirement_accumulate_time, out int requirementAccumulateTime); info.RequirementAccumulateTime = requirementAccumulateTime; string load_time = CommonBLL.GetFieldValue(fields, "LOAD_TIME"); int.TryParse(load_time, out int loadTime); info.LoadTime = loadTime; string transport_time = CommonBLL.GetFieldValue(fields, "TRANSPORT_TIME"); int.TryParse(transport_time, out int transportTime); info.TransportTime = transportTime; string unload_time = CommonBLL.GetFieldValue(fields, "UNLOAD_TIME"); int.TryParse(unload_time, out int unloadTime); info.UnloadTime = unloadTime; string delay_time = CommonBLL.GetFieldValue(fields, "DELAY_TIME"); int.TryParse(delay_time, out int delayTime); info.DelayTime = delayTime; string online_time = CommonBLL.GetFieldValue(fields, "ONLINE_TIME"); int.TryParse(online_time, out int onlineTime); info.OnlineTime = onlineTime; string requirement_accumulate_mode = CommonBLL.GetFieldValue(fields, "REQUIREMENT_ACCUMULATE_MODE"); int.TryParse(requirement_accumulate_mode, out int requirementAccumulateMode); info.RequirementAccumulateMode = requirementAccumulateMode; string status_point_code = CommonBLL.GetFieldValue(fields, "STATUS_POINT_CODE"); info.StatusPointCode = status_point_code; string twd_pull_mode = CommonBLL.GetFieldValue(fields, "TWD_PULL_MODE"); int.TryParse(twd_pull_mode, out int twdPullMode); int prevTwdPullMode = info.TwdPullMode.GetValueOrDefault(); info.TwdPullMode = twdPullMode; string roundness_mode = CommonBLL.GetFieldValue(fields, "ROUNDNESS_MODE"); int.TryParse(roundness_mode, out int roundnessMode); info.RoundnessMode = roundnessMode; ValidTwdPartBoxInfo(info); ///校验通过后将拉动模式\地点回复 info.TwdPullMode = prevTwdPullMode; info.SZoneNo = prevSZoneNo; info.TZoneNo = prevTZoneNo; if (info.Status.GetValueOrDefault() == (int)BasicDataStatusConstants.Disabled) { throw new Exception("MC:0x00000422");///已作废状态的零件类不能修改 } string loginUser = CommonBLL.GetFieldValue(fields, "MODIFY_USER"); info.ModifyUser = loginUser; info.ModifyDate = DateTime.Now; ///已发布状态的零件类只能更新部分信息 if (info.Status.GetValueOrDefault() == (int)BasicDataStatusConstants.Enable) { return(dal.Update(info) > 0 ? true : false); } StringBuilder @string = new StringBuilder(); ///是否更新了拉动模式,需要同步更新物料拉动信息中的拉动模式 if (info.TwdPullMode.GetValueOrDefault() != twdPullMode) { @string.AppendLine("update [LES].[TM_BAS_MAINTAIN_INHOUSE_LOGISTIC_STANDARD] " + "set [INHOUSE_SYSTEM_MODE] = N'" + twdPullMode + "',[MODIFY_USER] = N'" + loginUser + "',[MODIFY_DATE] = GETDATE() " + "where [INHOUSE_SYSTEM_MODE] = N'" + info.TwdPullMode.GetValueOrDefault() + "' and [INHOUSE_PART_CLASS] = N'" + info.PartBoxCode + "' and [VALID_FLAG] = 1;"); } ///执行 using (TransactionScope trans = new TransactionScope()) { if (dal.UpdateInfo(fields, id) == 0) { return(false); } if (@string.Length > 0) { CommonDAL.ExecuteNonQueryBySql(@string.ToString()); } trans.Complete(); } return(true); }
public ModuleInfoDAL() { _commonDAL = new CommonDAL<T_PF_MODULEINFO>(); _client = new CommonServices.UserLoginWS.MainUIServicesClient(); _prmClient = new CommonServices.PermissionWS.PermissionServiceClient(); }
public void TestDeleteEmployeeLeaveSummaryByApproveLeave() { // Insert a manager role Role managerRole = Role.CreateRole(Guid.NewGuid().ToString()); managerRole.Save(); // Insert an employee who is a manager Employee manager = Employee.CreateEmployee(Guid.NewGuid().ToString(), "123", Sex.Female, "Helen", DateTime.Now, "Niu"); manager.IsActive = true; manager.ServiceYears = 8; List <EmployeeRoleRL> managerRoleList = new List <EmployeeRoleRL>(); managerRoleList.Add(EmployeeRoleRL.CreateEmployeeRoleRL(Guid.Empty, managerRole.PKRoleID)); manager.SetRoleList(managerRoleList); manager.Save(); Guid managerGuid = manager.PKEmployeeID; // Insert a role Role role = Role.CreateRole(Guid.NewGuid().ToString()); role.Save(); // Insert an employee. Employee employee = Employee.CreateEmployee(Guid.NewGuid().ToString(), "123", Sex.Male, "Hui", DateTime.Now, "Ji"); employee.IsActive = true; employee.ServiceYears = 10; employee.FKReportManagerID = managerGuid; List <EmployeeRoleRL> employeeRoleList = new List <EmployeeRoleRL>(); employeeRoleList.Add(EmployeeRoleRL.CreateEmployeeRoleRL(Guid.Empty, role.PKRoleID)); employee.SetRoleList(employeeRoleList); employee.Save(); Guid employeeGuid = employee.PKEmployeeID; // Insert a leave type DateTime leaveTypeStartTime = Convert.ToDateTime("01/01/2000"); DateTime leaveTypeEndTime = Convert.ToDateTime("01/01/3000"); LeaveType leaveType = LeaveType.CreateLeaveType(Guid.NewGuid().ToString(), 100, leaveTypeStartTime, leaveTypeEndTime); leaveType.PKLeaveTypeID = Guid.NewGuid(); leaveType.Save(); Guid leaveTypeGuid = leaveType.PKLeaveTypeID; // Insert a leave time duration for this leave DateTime durationStartTime = Convert.ToDateTime("02/02/2001"); DateTime durationEndTime = Convert.ToDateTime("02/05/2001"); TimeDurationInfo timeDurationInfo = TimeDurationInfo.CreateTimeDurationInfo(durationStartTime, durationEndTime); DateTime durationStartTime2 = Convert.ToDateTime("02/02/2011"); DateTime durationEndTime2 = Convert.ToDateTime("02/05/2011"); TimeDurationInfo timeDurationInfo2 = TimeDurationInfo.CreateTimeDurationInfo(durationStartTime2, durationEndTime2); List <TimeDurationInfo> timeDurationList = new List <TimeDurationInfo>(); timeDurationList.Add(timeDurationInfo); timeDurationList.Add(timeDurationInfo2); int leaveHours = CommonMethods.ComputeHours(timeDurationList); LeaveInfo leave = LeaveBLL.ApplyLeave(employeeGuid.ToString(), "Test", leaveType.Name, "Test Desc", timeDurationList); // Approve the applying leave. LeaveBLL.ApproveLeave(managerGuid.ToString(), leave.PKLeaveInfoID.ToString(), LeaveStatus.Accepted); // Get the inserted employee leave summary List <SearchCondition> conditions = new List <SearchCondition>(); conditions.Add(SearchCondition.CreateSearchCondition("FKEmployeeID", employeeGuid.ToString(), SearchComparator.Equal, SearchType.SearchString)); conditions.Add(SearchCondition.CreateSearchCondition("FKLeaveTypeID", leaveTypeGuid.ToString(), SearchComparator.Equal, SearchType.SearchString)); EmployeeLeaveSummary employeeLeaveSummary = CommonDAL <EmployeeLeaveSummary> .GetSingleObject(conditions); // Apply another leave DateTime durationStartTime3 = DateTime.Parse("03/04/2011"); DateTime durationEndtime3 = DateTime.Parse("03/08/2011"); TimeDurationInfo timeDurationInfo3 = TimeDurationInfo.CreateTimeDurationInfo(durationStartTime3, durationEndtime3); DateTime durationStartTime4 = DateTime.Parse("03/10/2011"); DateTime durationEndtime4 = DateTime.Parse("03/11/2011"); TimeDurationInfo timeDurationInfo4 = TimeDurationInfo.CreateTimeDurationInfo(durationStartTime4, durationEndtime4); List <TimeDurationInfo> timeDurationList2 = new List <TimeDurationInfo>(); timeDurationList2.Add(timeDurationInfo3); timeDurationList2.Add(timeDurationInfo4); int newLeaveHours = CommonMethods.ComputeHours(timeDurationList2); LeaveInfo newLeave = LeaveBLL.ApplyLeave(employeeGuid.ToString(), "New Leave", leaveType.Name, "New Leave Desc", timeDurationList2); LeaveInfo delLeave = LeaveBLL.ApproveLeave(managerGuid.ToString(), newLeave.PKLeaveInfoID.ToString(), LeaveStatus.Accepted); delLeave.Delete(); // Get the update leave summary EmployeeLeaveSummary updatedLeaveSummary = CommonDAL <EmployeeLeaveSummary> .GetSingleObject(conditions); Assert.AreEqual(updatedLeaveSummary.UsedHours, leaveHours); // Delete inserted items employeeLeaveSummary.Delete(); leave.Delete(); leaveType.Delete(); employee.Delete(); manager.Delete(); managerRole.Delete(); role.Delete(); }
private void SaveOrderAndPrint(string strPrintType) { if (txtReadyTime.Text.Length > 0) { if (txtReadyTime.Text.Length != 5) { MessageBox.Show("Ready Time INPUT Error", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (saveTaCheckOrderInfo != null) { TaCheckOrderInfo taCheckOrder = saveTaCheckOrderInfo; taCheckOrder.PayTime = DateTime.Now.ToString(); taCheckOrder.PayPerDiscount = txtPercentDiscount.Text; taCheckOrder.PayDiscount = Math.Round(Convert.ToDecimal(txtDiscount.Text), 2).ToString(@"0.00"); taCheckOrder.PayPerSurcharge = txtPercentSurcharge.Text; taCheckOrder.PaySurcharge = Math.Round(Convert.ToDecimal(txtSurcharge.Text), 2).ToString(@"0.00"); taCheckOrder.PayType1 = lblPayType1.Text; taCheckOrder.PayTypePay1 = Math.Round(Convert.ToDecimal(txtPayTypePay1.Text), 2).ToString(@"0.00"); taCheckOrder.PayType2 = lblPayType2.Text; taCheckOrder.PayTypePay2 = Math.Round(Convert.ToDecimal(txtPayTypePay2.Text), 2).ToString(@"0.00"); taCheckOrder.PayType3 = lblPayType3.Text; taCheckOrder.PayTypePay3 = Math.Round(Convert.ToDecimal(txtPayTypePay3.Text), 2).ToString(@"0.00"); taCheckOrder.PayType4 = lblPayType4.Text; taCheckOrder.PayTypePay4 = Math.Round(Convert.ToDecimal(txtPayTypePay4.Text), 2).ToString(@"0.00"); taCheckOrder.PayType5 = lblPayType5.Text; taCheckOrder.PayTypePay5 = Math.Round(Convert.ToDecimal(txtPayTypePay5.Text), 2).ToString(@"0.00"); taCheckOrder.TotalAmount = Math.Round(Convert.ToDecimal(txtToPay.Text), 2).ToString(@"0.00"); taCheckOrder.Paid = Math.Round(Convert.ToDecimal(txtTendered.Text), 2).ToString(@"0.00"); taCheckOrder.IsPaid = IsPaid ? @"Y" : @"N"; taCheckOrder.BusDate = strBusDate; taCheckOrder.RefNum = ""; taCheckOrder.DeliveryFee = @"0.00"; WbPrtTemplataTa wbPrtTemplataTa = new WbPrtTemplataTa(); if (lstOrderItemInfos.Count < 1) { lstOrderItemInfos = CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(checkID) && s.BusDate.Equals(strBusDate)).ToList(); } wbPrtTemplataTa = GetAllPrtInfo(strPrintType); //_control.UpdateEntity(taCheckOrder); DelegateSaveCheckOrderAndPrint handler = DelegateMy.CheckOrderSaveAndPrint; IAsyncResult result = handler.BeginInvoke(taCheckOrder, strPrintType, lstOrderItemInfos, wbPrtTemplataTa, taCheckOrder.PayOrderType, null, null); } bool isOpenCashDrawSuccess = CommonDAL.OpenCashDraw(false, ""); if (!isOpenCashDrawSuccess) { MessageBox.Show(PubComm.CASH_DRAW_INFO, PubComm.CASH_DRAW_TEXT_TITLE, MessageBoxButtons.OK); } if (IsPaid) { returnPaid = true; this.DialogResult = DialogResult.OK; Hide(); } else { if (IsNotPaid) { returnPaid = true; this.DialogResult = DialogResult.OK; Hide(); } } }
/// <summary> /// 防错追溯,将信息添加到数据库 /// </summary> private void ScanResultToDb() { try { if (resultModel != null) { bool rst = false; if (!BaseVariable.NetworkStatus || !BaseVariable.ServerStatus) //离线状态 { resultModel.createtime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); BrakepumpResultMDL IsExistLocal = lResultDAL.GetModel(string.Format("barcode='{0}' and productcode='{1}'", this.txtHJCode.Text, this.txtProductCode.Text)); if (IsExistLocal != null && !IsExistLocal.tid.ToString().Equals("0")) { resultModel.tid = IsExistLocal.tid; string sql = DataExistToDb(false); rst = LocalDbDAL.ExecuteSql(sql); //存到本地数据库 } else { rst = lResultDAL.Add(resultModel); //添加到本地数据库 } } else //在线状态 { //添加批量追溯信息 GetBatchInfoToModel(); //同步到数据库:在没有同步到远程数据库时记录到本地数据库 #region 步到数据库 resultModel.createtime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); rst = false; //更新到远程服务器数据库是否成功 BrakepumpResultMDL IsExistRomote = resultDAL.GetModel(string.Format("barcode='{0}' and productcode='{1}'", this.txtHJCode.Text, this.txtProductCode.Text)); //更新到远程服务器数据库 if (IsExistRomote != null && !IsExistRomote.tid.ToString().Equals("0")) { resultModel.tid = IsExistRomote.tid; resultModel.createtime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); //封装更新字段 string sql = DataExistToDb(true); //sql += string.Format("CreateTime='{0}',", resultModel.CreateTime); rst = CommonDAL.ExecuteSql(sql, null); //存到远程服务器数据库 } else { rst = resultDAL.Add(resultModel); //添加到远程服务器数据库 } //更新到本地数据库 //rst = false; if (!rst) { BrakepumpResultMDL IsExistLocal = lResultDAL.GetModel(string.Format("barcode='{0}' and productcode='{1}'", this.txtHJCode.Text, this.txtProductCode.Text)); if (IsExistLocal != null && !IsExistLocal.tid.ToString().Equals("0")) { resultModel.tid = IsExistLocal.tid; string sql = DataExistToDb(false); rst = LocalDbDAL.ExecuteSql(sql); //存到本地数据库 } else { rst = lResultDAL.Add(resultModel); //添加到本地数据库 } } //批次材料数量更新 foreach (DictionaryEntry item in RemoteMaterialHT) // 遍历哈希表 { string code = item.Key.ToString(); ProductBomInfoMDL obj = item.Value as ProductBomInfoMDL; //var obj = item.Value; BatchNoMDL model = LocalMaterialHT[code] as BatchNoMDL; model.StockNum -= obj.MaterialNum; batchDAL.Update(model); //更新数据 } #endregion if (rst) { this.lblOK.Text = "OK"; this.lblOK.ForeColor = Color.Green; } else { this.lblOK.Text = "NG"; this.lblOK.ForeColor = Color.Red; } BatchChangeTip(); //批次数量提示 } } else { this.Tip("记录错误"); } } catch (Exception ex) { CLog.WriteErrLog("[FrmScan.ScanResultToDB]" + ex.Message); } }
/// <summary> /// 执行导入EXCEL数据 /// </summary> /// <param name="dataTable"></param> /// <param name="fieldNames"></param> /// <returns></returns> public bool ImportDataByExcel(DataTable dataTable, Dictionary <string, string> fieldNames, string loginUser) { List <StatusPointInfo> statusPointExcelInfos = CommonDAL.DatatableConvertToList <StatusPointInfo>(dataTable).ToList(); if (statusPointExcelInfos.Count == 0) { throw new Exception("MC:1x00000043");///数据格式不符合导入规范 } ///获取业务表中要变更的数据集合,准备对比 List <StatusPointInfo> statusPointInfos = dal.GetList("[STATUS_POINT_CODE] in ('" + string.Join("','", statusPointExcelInfos.Select(d => d.StatusPointCode).ToArray()) + "') ", string.Empty); ///执行的SQL语句 string sql = string.Empty; List <string> fields = new List <string>(fieldNames.Keys); ///逐条处理中间表数据 foreach (var statusPointExcelInfo in statusPointExcelInfos) { ///当前业务数据表中此工厂的该物流路线时需要新增 StatusPointInfo statusPointInfo = statusPointInfos.FirstOrDefault(d => d.StatusPointCode == statusPointExcelInfo.StatusPointCode); if (statusPointInfo == null) { if (string.IsNullOrEmpty(statusPointExcelInfo.StatusPointCode) || string.IsNullOrEmpty(statusPointExcelInfo.StatusPointName) || statusPointExcelInfo.StatusPointSeq != null || string.IsNullOrEmpty(statusPointExcelInfo.AssemblyLine) || string.IsNullOrEmpty(statusPointExcelInfo.Workshop) || string.IsNullOrEmpty(statusPointExcelInfo.Plant)) { throw new Exception("MC:0x00000368");///状态点代码、名称、顺序、工厂、车间、生产线不能为空 } ///字段 string insertFieldString = string.Empty; ///值 string insertValueString = string.Empty; for (int i = 0; i < fields.Count; i++) { string valueStr = CommonDAL.GetFieldValueForSql <StatusPointInfo>(statusPointExcelInfo, fields[i]); if (string.IsNullOrEmpty(valueStr)) { throw new Exception("MC:1x00000043");///数据格式不符合导入规范 } insertFieldString += "[" + fieldNames[fields[i]] + "],"; insertValueString += valueStr + ","; } ///判断业务主键是否重复,以防止EXCEL中有重复数据,适用于基础数据导入 sql += "if not exists (select * from LES.TM_BAS_STATUS_POINT with(nolock) where [STATUS_POINT_CODE] = N'" + statusPointExcelInfo.StatusPointCode + "' and [VALID_FLAG] = 1)" + " insert into [LES].[TM_BAS_STATUS_POINT] (" + "[FID]," + insertFieldString + "[CREATE_USER]," + "[CREATE_DATE]," + "[VALID_FLAG]" + ") values (" + "NEWID()," ///FID + insertValueString + "N'" + loginUser + "'," ///CREATE_USER + "GETDATE()," ///CREATE_DATE + "1" ///VALID_FLAG + ");"; ///为防止EXCEL中数据有重复 statusPointInfo = new StatusPointInfo(); statusPointInfo.StatusPointCode = statusPointExcelInfo.StatusPointCode; statusPointInfos.Add(statusPointInfo); /// continue; } if (string.IsNullOrEmpty(statusPointExcelInfo.StatusPointCode) || string.IsNullOrEmpty(statusPointExcelInfo.StatusPointName) || statusPointExcelInfo.StatusPointSeq != null || string.IsNullOrEmpty(statusPointExcelInfo.AssemblyLine) || string.IsNullOrEmpty(statusPointExcelInfo.Workshop) || string.IsNullOrEmpty(statusPointExcelInfo.Plant)) { throw new Exception("MC:0x00000368");///状态点代码、名称、顺序、工厂、车间、生产线不能为空 } ///值 string valueString = string.Empty; for (int i = 0; i < fields.Count; i++) { string valueStr = CommonDAL.GetFieldValueForSql <StatusPointInfo>(statusPointExcelInfo, fields[i]); if (string.IsNullOrEmpty(valueStr)) { throw new Exception("MC:1x00000043");///数据格式不符合导入规范 } valueString += "[" + fieldNames[fields[i]] + "] = " + valueStr + ","; } sql += "update [LES].[TM_BAS_STATUS_POINT] set " + valueString + "[MODIFY_USER] = N'" + loginUser + "'," + "[MODIFY_DATE] = GETDATE() " + "where [ID] = " + statusPointInfo.Id + ";"; } /// if (string.IsNullOrEmpty(sql)) { throw new Exception("MC:0x00000283");///:没有可导入更新的数据 } return(CommonDAL.ExecuteNonQueryBySql(sql)); }
/// <summary> /// 获取分页数据集合(默认降序) /// </summary> /// <param name="tableName">表名</param> /// <param name="columns">列明</param> /// <param name="condition">条件</param> /// <param name="key">主键,分页条件</param> /// <param name="orderColumn">排序字段</param> /// <param name="pageSize">每页记录数</param> /// <param name="pageCount">当前页数</param> /// <param name="totalNum">总记录数</param> /// <param name="totalPage">总页数</param> /// <returns></returns> public static DataTable GetPagerData(string tableName, string columns, string condition, string key, string orderColumn, int pageSize, int pageIndex, out int totalNum, out int pageCount) { return(CommonDAL.GetPagerData(tableName, columns, condition, key, orderColumn, pageSize, pageIndex, out totalNum, out pageCount, 0)); }
/// <summary> /// 绑定初始数据 /// </summary> /// <param name="busDate">营业日</param> private void GetBindData(string busDate) { var lstDb = lstAccountSummaryInfos; #region 统计面板 if (lstDb.Any()) { //txtTsTotalTA.Text = dTsTotalTA.ToString("0.00"); dTsCollection = lstDb.ToList().Any(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_COLLECTION) && s.BusDate.Equals(busDate)) ? lstDb.ToList().Where(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_COLLECTION) && s.BusDate.Equals(busDate)).Sum(s => Convert.ToDecimal(s.Paid)) : 0.00m; txtTsCollection.Text = dTsCollection.ToString("0.00"); dTsDelivery = lstDb.ToList().Any(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_DELIVERY) && s.BusDate.Equals(busDate)) ? lstDb.ToList().Where(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_DELIVERY) && s.BusDate.Equals(busDate)).Sum(s => Convert.ToDecimal(s.Paid)) : 0.00m; txtTsDelivery.Text = dTsDelivery.ToString("0.00"); dTsShop = lstDb.ToList().Any(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_SHOP) && s.BusDate.Equals(busDate)) ? lstDb.ToList().Where(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_SHOP) && s.BusDate.Equals(busDate)).Sum(s => Convert.ToDecimal(s.Paid)) : 0.00m; txtTsShop.Text = dTsShop.ToString("0.00"); dTsFastFood = lstDb.ToList().Any(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_FAST_FOOD) && s.BusDate.Equals(busDate)) ? lstDb.ToList().Where(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_FAST_FOOD) && s.BusDate.Equals(busDate)).Sum(s => Convert.ToDecimal(s.Paid)) : 0.00m; txtTsFastFood.Text = dTsFastFood.ToString("0.00"); dTsTotalTA = dTsCollection + dTsDelivery + dTsShop + dTsFastFood; txtTsTotalTA.Text = dTsTotalTA.ToString("0.00"); //dTsTotalOrder = lstDb.Count(s => s.gridBusDate.Equals(busDate)); dTsTotalOrder = lstDb.Count(); txtTsTotalOrder.Text = dTsTotalOrder.ToString(); dTsTotalCollection = lstDb.ToList().Any(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_COLLECTION) && s.BusDate.Equals(busDate)) ? lstDb.Count(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_COLLECTION) && s.BusDate.Equals(busDate)) : 0; txtTsTotalCol.Text = dTsTotalCollection.ToString(); dTsTotalDelivery = lstDb.ToList().Any(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_DELIVERY) && s.BusDate.Equals(busDate)) ? lstDb.Count(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_DELIVERY) && s.BusDate.Equals(busDate)) : 0; txtTsTotalDel.Text = dTsTotalDelivery.ToString(); dTsTotalShop = lstDb.ToList().Any(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_SHOP) && s.BusDate.Equals(busDate)) ? lstDb.Count(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_SHOP) && s.BusDate.Equals(busDate)) : 0; txtTsTotalShop.Text = dTsTotalShop.ToString(); dTsTotalFastFood = lstDb.ToList().Any(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_FAST_FOOD) && s.BusDate.Equals(busDate)) ? lstDb.Count(s => s.PayOrderType.Equals(PubComm.ORDER_TYPE_FAST_FOOD) && s.BusDate.Equals(busDate)) : 0; txtTsTotalFF.Text = dTsTotalFastFood.ToString(); dTsTotalOrder = dTsTotalDelivery + dTsTotalCollection + dTsTotalShop + dTsTotalFastFood; txtTsTotalOrder.Text = dTsTotalOrder.ToString(); dTsTotalDc = lstDb.ToList().Any() ? lstDb.ToList().Where(s => s.BusDate.Equals(busDate)).Sum(s => Convert.ToDecimal(s.DeliveryFee)) : 0.00m; txtTsTotalDc.Text = dTsTotalDc.ToString("0.00"); dTsTotalDcCash = lstDb.ToList().Any() ? lstDb.ToList().Where(s => s.BusDate.Equals(busDate) && Convert.ToDecimal(s.PayTypePay1) > 0m).Sum(s => Convert.ToDecimal(s.DeliveryFee)) : 0.00m; txtTsDcCash.Text = dTsTotalDcCash.ToString("0.00"); dTsTotalDcOther = lstDb.ToList().Any() ? lstDb.ToList().Where(s => s.BusDate.Equals(busDate) && Convert.ToDecimal(s.PayTypePay1) <= 0m).Sum(s => Convert.ToDecimal(s.DeliveryFee)) : 0.00m; txtTsDcOther.Text = dTsTotalDcOther.ToString("0.00"); txtStTotalTakings.Text = txtTsTotalTA.Text; txtStTotalOrder.Text = lstDb.Count(s => s.BusDate.Equals(busDate)).ToString(); txtStTotalVat.Text = (CommonDAL.GetAllVAT("", "", deDay.Text)).ToString("0.00"); txtEsTotalEatIn.Text = @"0.00"; txtEsSc.Text = @"0.00"; txtEsTotalOrder.Text = @"0.00"; } else { dTsTotalTA = 0.00m; txtTsTotalTA.Text = @"0.00"; dTsCollection = 0.00m; txtTsCollection.Text = @"0.00"; dTsDelivery = 0.00m; txtTsDelivery.Text = @"0.00"; dTsShop = 0.00m; txtTsShop.Text = @"0.00"; dTsFastFood = 0.00m; txtTsFastFood.Text = @"0.00"; dTsTotalOrder = 0; txtTsTotalOrder.Text = @"0"; dTsTotalCollection = 0; txtTsTotalCol.Text = @"0"; dTsTotalDelivery = 0; txtTsTotalDel.Text = @"0"; dTsTotalShop = 0; txtTsTotalShop.Text = @"0"; dTsTotalFastFood = 0; txtTsTotalFF.Text = @"0"; dTsTotalDc = 0.00m; txtTsTotalDc.Text = @"0.00"; dTsTotalDcCash = 0.00m; txtTsTotalDc.Text = @"0.00"; dTsTotalDcOther = 0.00m; txtTsDcOther.Text = @"0.00"; dEsTotalEatIn = 0.00m; txtEsTotalEatIn.Text = @"0.00"; dEsSc = 0.00m; txtEsSc.Text = @"0.00"; dEsTotalOrder = 0.00m; txtEsTotalOrder.Text = @"0"; dStTotalTakings = 0.00m; txtStTotalTakings.Text = @"0.00"; dStTotalOrder = 0.00m; txtStTotalOrder.Text = @"0.00"; dStTotalVat = 0.00m; txtStTotalVat.Text = @"0.00"; } #endregion #region 付款类型 lblPayType1.Text = @"Cash"; txtPtOrder1.Text = lstDb.Count(s => Convert.ToDecimal(s.PayTypePay1) > 0.0m && s.BusDate.Equals(deDay.Text)).ToString(); txtPtTotal1.Text = (lstDb.Where(s => Convert.ToDecimal(s.PayTypePay1) > 0.0m && s.BusDate.Equals(deDay.Text)).Sum(s => Convert.ToDecimal(s.PayTypePay1))).ToString("0.00"); txtPtTips1.Text = "0.00"; lblPayType2.Text = @"Card"; txtPtOrder2.Text = lstDb.Count(s => Convert.ToDecimal(s.PayTypePay2) > 0.0m && s.BusDate.Equals(deDay.Text)).ToString(); txtPtTotal2.Text = (lstDb.Where(s => Convert.ToDecimal(s.PayTypePay2) > 0.0m && s.BusDate.Equals(deDay.Text)).Sum(s => Convert.ToDecimal(s.PayTypePay2))).ToString("0.00"); txtPtTips2.Text = "0.00"; lblPayType3.Text = @"Other"; txtPtOrder3.Text = lstDb.Count(s => Convert.ToDecimal(s.PayTypePay3) > 0.0m && s.BusDate.Equals(deDay.Text)).ToString(); txtPtTotal3.Text = (lstDb.Where(s => Convert.ToDecimal(s.PayTypePay3) > 0.0m && s.BusDate.Equals(deDay.Text)).Sum(s => Convert.ToDecimal(s.PayTypePay3))).ToString("0.00"); txtPtTips3.Text = "0.00"; lblPayType4.Text = @"VISA"; txtPtOrder4.Text = lstDb.Count(s => Convert.ToDecimal(s.PayTypePay4) > 0.0m && s.BusDate.Equals(deDay.Text)).ToString(); txtPtTotal4.Text = (lstDb.Where(s => Convert.ToDecimal(s.PayTypePay4) > 0.0m && s.BusDate.Equals(deDay.Text)).Sum(s => Convert.ToDecimal(s.PayTypePay4))).ToString("0.00"); txtPtTips4.Text = "0.00"; lblPayType5.Text = @"PayPal"; txtPtOrder5.Text = lstDb.Count(s => Convert.ToDecimal(s.PayTypePay5) > 0.0m && s.BusDate.Equals(deDay.Text)).ToString(); txtPtTotal5.Text = (lstDb.Where(s => Convert.ToDecimal(s.PayTypePay5) > 0.0m && s.BusDate.Equals(deDay.Text)).Sum(s => Convert.ToDecimal(s.PayTypePay5))).ToString("0.00"); txtPtTips5.Text = "0.00"; #endregion }
private void btnRight_Click(object sender, EventArgs e) { deDay.Text = CommonDAL.SetDateTimeFormat(deDay.Text, 1); GetBindData(deDay.Text); }
private void FrmCaller_Load(object sender, EventArgs e) { string strDt = string.IsNullOrEmpty(strReadyTime) ? DateTime.Now.ToShortTimeString() : strReadyTime; string[] sRt = strDt.Split(':'); txtHour.Text = CommonDAL.SetAddZeroFront(sRt[0]); txtMinute.Text = CommonDAL.SetAddZeroFront(sRt[1]); #region 设置Panel #region 控件赋值 pcCust[0] = pcCust1; lblCustPhone[0] = lblCustPhone1; lblCustInfo[0] = lblCustInfo1; pcCust[1] = pcCust2; lblCustPhone[1] = lblCustPhone2; lblCustInfo[1] = lblCustInfo2; pcCust[2] = pcCust3; lblCustPhone[2] = lblCustPhone3; lblCustInfo[2] = lblCustInfo3; pcCust[3] = pcCust4; lblCustPhone[3] = lblCustPhone4; lblCustInfo[3] = lblCustInfo4; pcCust[4] = pcCust5; lblCustPhone[4] = lblCustPhone5; lblCustInfo[4] = lblCustInfo5; pcCust[5] = pcCust6; lblCustPhone[5] = lblCustPhone6; lblCustInfo[5] = lblCustInfo6; pcCust[6] = pcCust7; lblCustPhone[6] = lblCustPhone7; lblCustInfo[6] = lblCustInfo7; pcCust[7] = pcCust8; lblCustPhone[7] = lblCustPhone8; lblCustInfo[7] = lblCustInfo8; pcOrder[0] = pcOrder1; lblOderNo[0] = lblOrderNo1; lblOrderTime[0] = lblOrderTime1; pcOrder[1] = pcOrder2; lblOderNo[1] = lblOrderNo2; lblOrderTime[1] = lblOrderTime2; pcOrder[2] = pcOrder3; lblOderNo[2] = lblOrderNo3; lblOrderTime[2] = lblOrderTime3; pcOrder[3] = pcOrder4; lblOderNo[3] = lblOrderNo4; lblOrderTime[3] = lblOrderTime4; pcOrder[4] = pcOrder5; lblOderNo[4] = lblOrderNo5; lblOrderTime[4] = lblOrderTime5; #endregion #endregion SetNumClick(); SetAddClick(); SetPanelCustInfo(); SetPanelOrderInfo(); lblCallInfo.Text = DateTime.Now.ToShortDateString() + @" " + DateTime.Now.ToShortTimeString(); txtTelNum.Text = strCallPhone.Trim(); SetUsrComePhoneAndIsNewUser(txtTelNum.Text); asfc.controllInitializeSize(this); //LogHelper.Info(@"FrmCaller_Load"); }
protected void btnSave_Click(object sender, EventArgs e) { try { string createdBy = "Admin"; // Session["LoginName"].ToString(); string unitName; if (btnSave.Text == "Save") { int activeStatus = 0; int masterID = 0; if (txtUnitName.Text != string.Empty && txtUnitName.Text != "") { unitName = txtUnitName.Text; } else { CommonDAL.DisplayPopUpMessage(this, "Scheme Name Rquired Field", ""); return; } int result = obll.SaveUpdateScheme(activeStatus, createdBy, unitName, masterID); if (result > 0) { CommonDAL.DisplayPopUpMessage(this, "Scheme Saved Successfully", ""); bindGrid(0); divGirdShow.Visible = true; divEnterDetails.Visible = false; } else if (result == -3) { CommonDAL.DisplayPopUpMessage(this, "Scheme Already Exist", ""); return; } else { CommonDAL.DisplayPopUpMessage(this, "Scheme Not Saved", ""); return; } } else { int activeStatus; string unit_Name; if (rbtActive.Checked == true) { activeStatus = 0; } else { activeStatus = 1; } if (txtUnitName.Text != string.Empty && txtUnitName.Text != "") { unit_Name = txtUnitName.Text; } else { CommonDAL.DisplayPopUpMessage(this, "Scheme Name Rquired Field", ""); return; } int result = obll.SaveUpdateScheme(activeStatus, createdBy, unit_Name, Convert.ToInt32(ViewState["UNIT_RECNO"])); if (result > 0) { CommonDAL.DisplayPopUpMessage(this, "Scheme Updated Successfully", ""); bindGrid(0); divGirdShow.Visible = true; divEnterDetails.Visible = false; } else if (result == -3) { CommonDAL.DisplayPopUpMessage(this, "Scheme Already Exist", ""); return; } else { CommonDAL.DisplayPopUpMessage(this, "Scheme Not Updated", ""); return; } } } catch (Exception ex) { AppConstants OAp = new AppConstants(); String FUNCTION_NAME = "btnSave_Click"; String MODULE_NAME = "SchemeMaster.aspx"; String ERROR_TYPE = "Application"; String ERROR_DESC = ex.Message; string lineNumber = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7); string url = HttpContext.Current.Request.Url.AbsoluteUri; OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber); } }
/// <summary> /// 执行导入EXCEL数据 /// </summary> /// <param name="dataTable"></param> /// <param name="fieldNames"></param> /// <returns></returns> public bool ImportDataByExcel(DataTable dataTable, Dictionary <string, string> fieldNames, string loginUser) { List <TwdPartBoxInfo> twdPartBoxExcelInfos = CommonDAL.DatatableConvertToList <TwdPartBoxInfo>(dataTable).ToList(); if (twdPartBoxExcelInfos.Count == 0) { throw new Exception("MC:1x00000043");///数据格式不符合导入规范 } ///获取业务表中要变更的数据集合,准备对比 List <TwdPartBoxInfo> twdPartBoxInfos = new TwdPartBoxDAL().GetList("[PART_BOX_CODE] in ('" + string.Join("', '", twdPartBoxExcelInfos.Select(d => d.PartBoxCode).ToList().ToArray()) + "')", ""); ///执行的SQL语句 StringBuilder @string = new StringBuilder(); List <string> fields = new List <string>(fieldNames.Keys); ///逐条处理中间表数据 foreach (var twdPartBoxExcelInfo in twdPartBoxExcelInfos) { TwdPartBoxInfo twdPartBoxInfo = twdPartBoxInfos.FirstOrDefault(d => d.PartBoxCode == twdPartBoxExcelInfo.PartBoxCode); ///需要新增 if (twdPartBoxInfo == null) { ///校验 ValidTwdPartBoxInfo(twdPartBoxExcelInfo); ///字段 string insertFieldString = string.Empty; ///值 string insertValueString = string.Empty; for (int i = 0; i < fields.Count; i++) { string valueStr = CommonDAL.GetFieldValueForSql <TwdPartBoxInfo>(twdPartBoxExcelInfo, fields[i]); if (string.IsNullOrEmpty(valueStr)) { throw new Exception("MC:1x00000043");///数据格式不符合导入规范 } insertFieldString += "[" + fieldNames[fields[i]] + "],"; insertValueString += valueStr + ","; } ///判断业务主键是否重复,以防止EXCEL中有重复数据,适用于基础数据导入 @string.AppendLine("if not exists (select * from LES.TM_MPM_TWD_PART_BOX with(nolock) " + "where [PART_BOX_CODE] = N'" + twdPartBoxExcelInfo.PartBoxCode + "' and [VALID_FLAG] = 1)" + " insert into [LES].[TM_MPM_TWD_PART_BOX] (" + "[FID]," + insertFieldString + "[STATUS]," + "[CREATE_USER]," + "[CREATE_DATE]," + "[VALID_FLAG]" + ") values (" + "NEWID(),"///FID + insertValueString + (int)BasicDataStatusConstants.Created + "," + "N'" + loginUser + "'," ///CREATE_USER + "GETDATE()," ///CREATE_DATE + "1" ///VALID_FLAG + ");"); ///防止EXCEL中有重复项 twdPartBoxInfos.Add(twdPartBoxExcelInfo); continue; } /// if (twdPartBoxInfo.Status.GetValueOrDefault() == (int)BasicDataStatusConstants.Disabled) { continue; } /// twdPartBoxExcelInfo.Id = twdPartBoxInfo.Id; ///校验 ValidTwdPartBoxInfo(twdPartBoxExcelInfo); ///是否更新了拉动模式,需要同步更新物料拉动信息中的拉动模式 if (twdPartBoxInfo.TwdPullMode.GetValueOrDefault() != twdPartBoxExcelInfo.TwdPullMode.GetValueOrDefault()) { @string.AppendLine("update [LES].[TM_BAS_MAINTAIN_INHOUSE_LOGISTIC_STANDARD] " + "set [INHOUSE_SYSTEM_MODE] = N'" + twdPartBoxExcelInfo.TwdPullMode.GetValueOrDefault() + "'," + "[MODIFY_USER] = N'" + loginUser + "'," + "[MODIFY_DATE] = GETDATE() " + "where [INHOUSE_SYSTEM_MODE] = N'" + twdPartBoxInfo.TwdPullMode.GetValueOrDefault() + "' and " + "[INHOUSE_PART_CLASS] = N'" + twdPartBoxExcelInfo.PartBoxCode + "' and " + "[VALID_FLAG] = 1;"); } ///已创建状态的数据可以全信息更新 if (twdPartBoxInfo.Status.GetValueOrDefault() == (int)BasicDataStatusConstants.Created) { ///值 string valueString = string.Empty; for (int i = 0; i < fields.Count; i++) { string valueStr = CommonDAL.GetFieldValueForSql <TwdPartBoxInfo>(twdPartBoxExcelInfo, fields[i]); if (string.IsNullOrEmpty(valueStr)) { throw new Exception("MC:1x00000043");///数据格式不符合导入规范 } valueString += "[" + fieldNames[fields[i]] + "] = " + valueStr + ","; } @string.AppendLine("update [LES].[TM_MPM_TWD_PART_BOX] set " + valueString + "[MODIFY_USER] = N'" + loginUser + "'," + "[MODIFY_DATE] = GETDATE() " + "where [ID] = " + twdPartBoxInfo.Id + ";"); continue; } /// @string.AppendLine("update [LES].[TM_MPM_TWD_PART_BOX] " + "set [PART_BOX_NAME] = N'" + twdPartBoxExcelInfo.PartBoxName + "'," + "[REQUIREMENT_ACCUMULATE_TIME] = " + (twdPartBoxExcelInfo.RequirementAccumulateTime == null ? "NULL" : "" + twdPartBoxExcelInfo.RequirementAccumulateTime.GetValueOrDefault() + "") + "," + "[LOAD_TIME] = " + (twdPartBoxExcelInfo.LoadTime == null ? "NULL" : "" + twdPartBoxExcelInfo.LoadTime.GetValueOrDefault() + "") + "," + "[TRANSPORT_TIME] = " + (twdPartBoxExcelInfo.TransportTime == null ? "NULL" : "" + twdPartBoxExcelInfo.TransportTime.GetValueOrDefault() + "") + "," + "[UNLOAD_TIME] = " + (twdPartBoxExcelInfo.UnloadTime == null ? "NULL" : "" + twdPartBoxExcelInfo.UnloadTime.GetValueOrDefault() + "") + "," + "[DELAY_TIME] = " + (twdPartBoxExcelInfo.DelayTime == null ? "NULL" : "" + twdPartBoxExcelInfo.DelayTime.GetValueOrDefault() + "") + "," + "[ONLINE_TIME] = " + (twdPartBoxExcelInfo.OnlineTime == null ? "NULL" : "" + twdPartBoxExcelInfo.OnlineTime.GetValueOrDefault() + "") + "," + "[REQUIREMENT_ACCUMULATE_MODE] = " + twdPartBoxExcelInfo.RequirementAccumulateMode.GetValueOrDefault() + "," + "[STATUS_POINT_CODE] = N'" + twdPartBoxExcelInfo.StatusPointCode + "'," + "[ROUNDNESS_MODE] = " + twdPartBoxExcelInfo.RoundnessMode.GetValueOrDefault() + "," + "[MODIFY_USER] = N'" + loginUser + "'," + "[MODIFY_DATE] = GETDATE() " + "where [ID] = " + twdPartBoxInfo.Id + ";"); } ///执行 using (TransactionScope trans = new TransactionScope()) { if (@string.Length > 0) { CommonDAL.ExecuteNonQueryBySql(@string.ToString()); } trans.Complete(); } return(true); }
/// <summary> /// 获取表中某字段值 /// </summary> /// <param name="tableName">表名</param> /// <param name="columnName">字段名</param> /// <param name="columnValue">字段值</param> /// <param name="where">条件</param> /// <returns></returns> public static object Select(string tableName, string columnName, string where) { object obj = CommonDAL.Select(tableName, columnName, where); return(obj); }
public static DataTable GetSearchData(string query) { return(CommonDAL.GetData(query)); }
/// <summary> /// 删除记录 /// </summary> /// <param name="tableName">表名</param> /// <param name="where">条件</param> /// <returns></returns> public static bool Delete(string tableName, string where) { int obj = CommonDAL.Delete(tableName, where); return(obj > 0); }
public static DataTable GetSearchData(string tableName, int rowCount) { return(CommonDAL.FetchSearchData(tableName, rowCount)); }
private WbPrtTemplataTa GetAllPrtInfo(string strPrintType) { WbPrtTemplataTa wbPrtTemplataTa = new WbPrtTemplataTa(); //new SystemData().GetTaSysPrtSetGeneral(); TaSysPrtSetGeneralInfo taSysPrtSetGeneralInfo = CommonData.TaSysPrtSetGeneral.FirstOrDefault();; if (taSysPrtSetGeneralInfo != null) { //wbPrtTemplataTa.PrintAddress = taSysPrtSetGeneralInfo.IsPrtAddr; //new SystemData().GetTaSysCtrl(); var lstTaSysCtrl = CommonData.TaSysCtrl; if (lstTaSysCtrl.Any()) { wbPrtTemplataTa.PrintAddress = lstTaSysCtrl.FirstOrDefault().ShopAddress; } wbPrtTemplataTa.PrintTel = taSysPrtSetGeneralInfo.TelNo; wbPrtTemplataTa.VATNo = taSysPrtSetGeneralInfo.VATNo; wbPrtTemplataTa.Msg1 = taSysPrtSetGeneralInfo.Msg1; wbPrtTemplataTa.Msg2 = taSysPrtSetGeneralInfo.Msg2; wbPrtTemplataTa.Msg3 = taSysPrtSetGeneralInfo.Msg3; wbPrtTemplataTa.Msg4 = taSysPrtSetGeneralInfo.Msg4; wbPrtTemplataTa.Msg5 = taSysPrtSetGeneralInfo.Msg5; } if (!string.IsNullOrEmpty(callerID)) { //new SystemData().GetTaCustomer(); var lstCust = CommonData.TaCustomer.Where(s => s.ID.ToString().Equals(callerID)); if (lstCust.Any()) { TaCustomerInfo taCustomerInfo = lstCust.FirstOrDefault(); wbPrtTemplataTa.CustName = taCustomerInfo.cusName; wbPrtTemplataTa.CustPhone = taCustomerInfo.cusPhone; wbPrtTemplataTa.CustDist = taCustomerInfo.cusDistance; wbPrtTemplataTa.CustMapRef = taCustomerInfo.cusPcZone; wbPrtTemplataTa.CustHouseNo = taCustomerInfo.cusHouseNo; wbPrtTemplataTa.CustAddr = taCustomerInfo.cusAddr; wbPrtTemplataTa.CustPostCode = taCustomerInfo.cusPostcode; //wbPrtTemplataTa.ShopTime = taCustomerInfo.cusReadyTime; } } wbPrtTemplataTa.ShopTime = string.IsNullOrEmpty(txtReadyTime.Text) ? "ASAP" : txtReadyTime.Text; wbPrtTemplataTa.OrderDate = DateTime.Now.ToShortDateString(); wbPrtTemplataTa.OrderTime = DateTime.Now.ToShortTimeString(); wbPrtTemplataTa.Staff = htDetail["Staff"].ToString(); wbPrtTemplataTa.OrderNo = checkID; wbPrtTemplataTa.ItemCount = htDetail["ItemQty"].ToString(); wbPrtTemplataTa.SubTotal = htDetail["SubTotal"].ToString(); wbPrtTemplataTa.Total = txtToPay.Text; wbPrtTemplataTa.PayType = IsNotPaid ? @"NOT PAID" : CommonDAL.GetPayType(saveTaCheckOrderInfo); wbPrtTemplataTa.Tendered = txtTendered.Text; wbPrtTemplataTa.Change = string.IsNullOrEmpty(txtChange.Text) ? "0.00" : (Convert.ToDecimal(txtChange.Text)).ToString("0.00"); wbPrtTemplataTa.OrderType = orderType; wbPrtTemplataTa.RefNo = ""; wbPrtTemplataTa.DeliveryFee = @"0.00"; wbPrtTemplataTa.Discount = txtDiscount.Text; wbPrtTemplataTa.Surcharge = txtSurcharge.Text; #region VAT计算 if (strPrintType.Equals(WbPrtStatic.PRT_CLASS_ALL_AND_RECEIPT)) { GenSetInfo gsi = CommonData.GenSet.FirstOrDefault(); if (gsi != null) { var lstVAT = from oi in lstOrderItemInfos join mi in CommonData.TaMenuItem on oi.ItemCode equals mi.MiDishCode select new { VatInfo = mi.MiRmk, ItemTotalPrice = oi.ItemTotalPrice }; //new SystemData().GetOrderItemMatchVat(checkID, strBusDate); //var lstVAT = CommonData.GetOrderItemMatchVat; decimal dTotal = 0; decimal dVatTmp = 0; decimal dVat = 0; if (lstVAT.Any()) { //VAT1 wbPrtTemplataTa.Rate1 = gsi.VATPer + @"%"; dTotal = lstVAT.Where(s => !s.VatInfo.Contains("Without VAT")).ToList().Sum(vat => Convert.ToDecimal(vat.ItemTotalPrice)); //交税 dVatTmp = dTotal / ((100 + Convert.ToDecimal(gsi.VATPer)) / 100); dVat = Math.Round(dVatTmp, 2, MidpointRounding.AwayFromZero); // wbPrtTemplataTa.Net1 = dVat.ToString("0.00"); wbPrtTemplataTa.VatA = (dTotal - dVat).ToString("0.00"); wbPrtTemplataTa.Gross1 = dTotal.ToString("0.00"); //VAT2 dTotal = lstVAT.Where(s => s.VatInfo.Contains("Without VAT")).ToList().Sum(vat => Convert.ToDecimal(vat.ItemTotalPrice)); wbPrtTemplataTa.Rate2 = @"0.0%"; wbPrtTemplataTa.Net2 = dTotal.ToString("0.00"); wbPrtTemplataTa.VatB = @"0.00"; wbPrtTemplataTa.Gross2 = dTotal.ToString("0.00"); } } else { wbPrtTemplataTa.Rate1 = "0.00%"; wbPrtTemplataTa.Net1 = "0.00"; wbPrtTemplataTa.VatA = "0.00"; wbPrtTemplataTa.Gross1 = "0.00"; wbPrtTemplataTa.Rate2 = "0.00%"; wbPrtTemplataTa.Net2 = "0.00"; wbPrtTemplataTa.VatB = "0.00"; wbPrtTemplataTa.Gross2 = "0.00"; } } #endregion return(wbPrtTemplataTa); }
public static DataTable GetOperationSearchData(string customerCode) { return(CommonDAL.GetData(CommonSQLStrings.GetOperationQuery(customerCode))); }
private void SaveOrder(bool isPaid) { if (txtReadyTime.Text.Length > 0) { if (txtReadyTime.Text.Length != 5) { MessageBox.Show("Ready Time INPUT Error", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } //new SystemData().GetTaCheckOrder(); //var lstChk = CommonData.TaCheckOrder.Where(s => s.CheckCode.Equals(checkID) && s.BusDate.Equals(strBusDate)); //if (lstChk.Any()) //{ // TaCheckOrderInfo taCheckOrder = lstChk.FirstOrDefault(); if (saveTaCheckOrderInfo != null) { TaCheckOrderInfo taCheckOrder = saveTaCheckOrderInfo; taCheckOrder.PayTime = DateTime.Now.ToString(); taCheckOrder.PayPerDiscount = txtPercentDiscount.Text; taCheckOrder.PayDiscount = Math.Round(Convert.ToDecimal(txtDiscount.Text), 2).ToString(@"0.00"); taCheckOrder.PayPerSurcharge = txtPercentSurcharge.Text; taCheckOrder.PaySurcharge = Math.Round(Convert.ToDecimal(txtSurcharge.Text), 2).ToString(@"0.00"); taCheckOrder.PayType1 = lblPayType1.Text; taCheckOrder.PayTypePay1 = Math.Round(Convert.ToDecimal(txtPayTypePay1.Text), 2).ToString(@"0.00"); taCheckOrder.PayType2 = lblPayType2.Text; taCheckOrder.PayTypePay2 = Math.Round(Convert.ToDecimal(txtPayTypePay2.Text), 2).ToString(@"0.00"); taCheckOrder.PayType3 = lblPayType3.Text; taCheckOrder.PayTypePay3 = Math.Round(Convert.ToDecimal(txtPayTypePay3.Text), 2).ToString(@"0.00"); taCheckOrder.PayType4 = lblPayType4.Text; taCheckOrder.PayTypePay4 = Math.Round(Convert.ToDecimal(txtPayTypePay4.Text), 2).ToString(@"0.00"); taCheckOrder.PayType5 = lblPayType5.Text; taCheckOrder.PayTypePay5 = Math.Round(Convert.ToDecimal(txtPayTypePay5.Text), 2).ToString(@"0.00"); taCheckOrder.TotalAmount = Math.Round(Convert.ToDecimal(txtToPay.Text), 2).ToString(@"0.00"); taCheckOrder.Paid = Math.Round(Convert.ToDecimal(txtTendered.Text), 2).ToString(@"0.00"); taCheckOrder.IsPaid = isPaid ? @"Y" : @"N"; taCheckOrder.BusDate = CommonDAL.GetBusDate(); taCheckOrder.DriverID = iDriverID; taCheckOrder.CustomerNote = strDeliveryNote; taCheckOrder.DeliveryFee = @"0.00"; taCheckOrder.RefNum = ""; saveTaCheckOrderInfo = taCheckOrder; //_control.UpdateEntity(taCheckOrder); //DelegateSaveCheckOrder handler = DelegateMy.SaveCheckOrder; //IAsyncResult result = handler.BeginInvoke(taCheckOrder, true,null, null); CommonDAL.SaveOrUpdateCheckOrder(taCheckOrder); } returnPaid = true; //this.DialogResult = DialogResult.OK; //Hide(); }
public static DataTable GetCustomerSearchData() { return(CommonDAL.GetData(CommonSQLStrings.GetCustomerQuery(""))); }
/// <summary> /// 封装更新字段 /// </summary> /// <param name="IsRemote"></param> /// <returns></returns> private string DataExistToDb(bool IsRemote) { string sql = string.Format("SELECT * FROM materialfield WHERE materialcode in(SELECT materialcode FROM productbominfo WHERE producttype='{0}' AND productcode='{1}')", BaseVariable.DeviceEntity.ProductType, resultModel.productcode); DataTable fieldTable = null; if (IsRemote) { fieldTable = CommonDAL.GetDataTable(sql); //远程获取 } else { fieldTable = LocalDbDAL.GetDataTable(sql); //本地获取 } sql = ""; #region 对应更新字段 if (fieldTable != null && fieldTable.Rows.Count > 0) { foreach (DataRow fieldRow in fieldTable.Rows) { string filed = fieldRow["FieldName"].ToString(); #region 对应更新字段 switch (filed) { //制动泵编码 case "brakepumpcode": sql += string.Format("brakepumpcode='{0}',", resultModel.brakepumpcode); break; //密封垫批次号 case "gasketbatchno": sql += string.Format("gasketbatchno='{0}',", resultModel.gasketbatchno); break; //六角(法兰面)螺母 case "hexagonalnutbatchno": sql += string.Format("hexagonalnutbatchno='{0}',", resultModel.hexagonalnutbatchno); break; //压力传感器批次号 case "pressuresensorbatchno": sql += string.Format("pressuresensorbatchno='{0}',", resultModel.pressuresensorbatchno); break; //消音器(制动泵隔音垫) case "silencerbatchno": sql += string.Format("silencerbatchno='{0}',", resultModel.silencerbatchno); break; //结合管(制动连接管) case "connectingpipe": sql += string.Format("connectingpipe='{0}',", resultModel.connectingpipe); break; //助力器制动泵支架 case "boosterbrakepumpbracket": sql += string.Format("boosterbrakepumpbracket='{0}',", resultModel.boosterbrakepumpbracket); break; } #endregion } } #endregion sql = sql.Substring(0, sql.LastIndexOf(',')); sql += string.Format(" where tid={0}", resultModel.tid); return(sql); }
public string GetStatisticsData(string requestMsg, HeadMessage head) { sendHead.Method = head.Method ?? ""; error.ErrNo = "0004"; string responseMsg = ""; string pId; try { if (CommonDAL.IsSubAgent(head.LoginID, out pId)) { head.LoginID = pId;//如果当前登录代理是子账号则,将此子账号的所属代理ID赋值为当前登录代理ID } StatisticsModel sModel = JSON.ToObject <StatisticsModel>(requestMsg); if (sModel == null) { error.ErrMsg = "没有接收到正确的请求参数"; } else { switch (sendHead.Method) { case "GetAStatistics": //获取代理统计数据 responseMsg = sDal.GetAStatistics(sModel, head, out error); break; case "GetADayStatistics": //获取代理每日统计数据 responseMsg = sDal.GetADayStatistics(sModel, head, out error); break; case "GetOddsWashF4Agent": //获取代理抽水及洗码费统计 responseMsg = sDal.GetOddsWashF4Agent(sModel, head, out error); break; case "GetClntStatistics": //获取会员统计数据 responseMsg = cDal.GetClntStatistics(sModel, head, out error); break; case "GetClntDayStatistics": //获取会员每日统计数据 responseMsg = cDal.GetClntDayStatistics(sModel, head, out error); break; case "GetClntBetBills": //获取会员下注明细 responseMsg = cDal.GetClntBetBills(sModel, head, out error); break; case "GetPointDetail": //获取上下分明细 responseMsg = cDal.GetPointDetail(sModel, head, out error); break; case "GetTableResult": //获取游戏结果数据 responseMsg = cDal.GetTableResult(sModel, head, out error); break; case "PromotionA_Clnt4A": //获取指定代理下的会员推广统计数据 增量 responseMsg = cDal.PromotionA_Clnt4A(sModel, head, out error); break; case "PromotionA_AllClnt4A": //获取指定代理下的会员推广统计数据 存量 responseMsg = cDal.PromotionA_AllClnt4A(sModel, head, out error); break; case "H5ClntPointSum": //指定代理下H5会员第三方上分合计 responseMsg = cDal.H5ClntPointSum(sModel, head, out error); break; case "H5ClntPointDetail": //H5会员第三方上分明细 responseMsg = cDal.H5ClntPointDetail(sModel, head, out error); break; case "H5ClntPointSum_A": //获取指定代理下所有H5会员第三方上分明细 responseMsg = cDal.H5ClntPointDetail_A(sModel, head, out error); break; case "RedEnvelopeSum": //查询指定代理自己及直属代理及直属会员下红包发放合计 responseMsg = cDal.RedEnvelopeSum(sModel, head, out error); break; case "RedEnvelopeDetail": //查询指定会员下红包发送明细 responseMsg = cDal.RedEnvelopeDetail(sModel, head, out error); break; case "GetSettleAccounts": //获取结算记录 responseMsg = cDal.GetSettleAccounts(sModel, head, out error); break; case "GetWashF4Clnt": //获取会员洗码费统计 responseMsg = cDal.GetOddsWashF4Clnt(sModel, head, out error); break; } } sendMsg.Head = JSON.ToJSON(sendHead); sendMsg.Error = JSON.ToJSON(error); sendMsg.Reponse = string.IsNullOrEmpty(responseMsg) ? "{}" : responseMsg; return(JSON.ToJSON(sendMsg)); } catch (Exception ex) { Common.LogHelper.WriteLog(typeof(LoginBLL), ex); error.ErrMsg = ex.Message.Replace("\r", "").Replace("\n", ""); sendMsg.Head = JSON.ToJSON(sendHead); sendMsg.Reponse = "{}"; sendMsg.Error = JSON.ToJSON(error); return(JSON.ToJSON(sendMsg)); } }
/// <summary> /// 发布 /// </summary> /// <param name="rowsKeyValues"></param> /// <param name="loginUser"></param> /// <returns></returns> public bool ReleaseInfos(List <string> rowsKeyValues, string loginUser) { List <EmergencyPullingCartInfo> emergencyPullingCarts = new List <EmergencyPullingCartInfo>(); foreach (var rowsKeyValue in rowsKeyValues) { string[] keyValues = rowsKeyValue.Split(new char[] { '^' }, StringSplitOptions.RemoveEmptyEntries); if (keyValues.Length == 0) { throw new Exception("MC:0x00000084");///数据错误 } if (keyValues.Length == 1) { throw new Exception("MC:0x00000502");///物料需求数量不能为空 } EmergencyPullingCartInfo emergencyPullingCart = new EmergencyPullingCartInfo(); emergencyPullingCart.Id = Convert.ToInt64(keyValues[0]); emergencyPullingCart.RequiredPartQty = Convert.ToDecimal(keyValues[1]); if (emergencyPullingCart.RequiredPartQty <= 0) { throw new Exception("MC:0x00000507");///物料需求数量不能小于等于零 } emergencyPullingCarts.Add(emergencyPullingCart); } List <EmergencyPullingCartInfo> emergencyPullingCartInfos = dal.GetList("[ID] in (" + string.Join(",", emergencyPullingCarts.Select(d => d.Id).ToArray()) + ")", string.Empty); if (emergencyPullingCartInfos.Count == 0) { throw new Exception("MC:0x00000084");///数据错误 } StringBuilder @string = new StringBuilder(); foreach (EmergencyPullingCartInfo emergencyPullingCartInfo in emergencyPullingCartInfos) { EmergencyPullingCartInfo cartInfo = emergencyPullingCarts.FirstOrDefault(d => d.Id == emergencyPullingCartInfo.Id); if (cartInfo == null) { continue; } emergencyPullingCartInfo.RequiredPartQty = cartInfo.RequiredPartQty; ///REQUIRED_BOX_QTY if (emergencyPullingCartInfo.PullPackageQty.GetValueOrDefault() > 0) { emergencyPullingCartInfo.RequiredBoxQty = Convert.ToInt32(Math.Ceiling(emergencyPullingCartInfo.RequiredPartQty.GetValueOrDefault() / emergencyPullingCartInfo.PullPackageQty.GetValueOrDefault())); } @string.AppendLine("update [LES].[TE_MPM_EMERGENCY_PULLING_CART] " + "set [VALID_FLAG] = 0," + "[REQUIRED_PART_QTY] = " + emergencyPullingCartInfo.RequiredPartQty.GetValueOrDefault() + "," + "[REQUIRED_BOX_QTY] = " + emergencyPullingCartInfo.RequiredBoxQty.GetValueOrDefault() + "," + "[MODIFY_USER] = N'" + loginUser + "'," + "[MODIFY_DATE] = GETDATE() " + "where [ID] = " + emergencyPullingCartInfo.Id + ";"); } @string.AppendLine(Handler(emergencyPullingCartInfos, loginUser)); ///执行 using (var trans = new TransactionScope()) { if (@string.Length > 0) { CommonDAL.ExecuteNonQueryBySql(@string.ToString()); } trans.Complete(); } return(true); }
/// <summary> /// 执行导入EXCEL数据 /// </summary> /// <param name="dataTable"></param> /// <param name="fieldNames"></param> /// <returns></returns> public bool ImportDataByExcel(DataTable dataTable, Dictionary <string, string> fieldNames, string loginUser) { List <LocationInfo> locationExcelInfos = CommonDAL.DatatableConvertToList <LocationInfo>(dataTable).ToList(); if (locationExcelInfos.Count == 0) { throw new Exception("MC:1x00000043");///数据格式不符合导入规范 } ///获取业务表中要变更的数据集合,准备对比 List <LocationInfo> routeInfos = new LocationDAL().GetListForInterfaceDataSync(locationExcelInfos.Select(d => d.Location).ToList()); ///执行的SQL语句 string sql = string.Empty; List <string> fields = new List <string>(fieldNames.Keys); ///逐条处理中间表数据 foreach (var locationExcelInfo in locationExcelInfos) { /// LocationInfo locationInfo = routeInfos.FirstOrDefault(d => d.Location == locationExcelInfo.Location); if (locationInfo == null) { if (string.IsNullOrEmpty(locationExcelInfo.Location) || string.IsNullOrEmpty(locationExcelInfo.LocationName) || string.IsNullOrEmpty(locationExcelInfo.Plant)) { throw new Exception("MC:0x00000222");///工位代码、名称、对应工厂为必填项 } ///字段 string insertFieldString = string.Empty; ///值 string insertValueString = string.Empty; for (int i = 0; i < fields.Count; i++) { string valueStr = CommonDAL.GetFieldValueForSql <LocationInfo>(locationExcelInfo, fields[i]); if (string.IsNullOrEmpty(valueStr)) { throw new Exception("MC:1x00000043");///数据格式不符合导入规范 } insertFieldString += "[" + fieldNames[fields[i]] + "],"; insertValueString += valueStr + ","; } sql += "if not exists (select * from LES.TM_BAS_LOCATION with(nolock) where [LOCATION] = N'" + locationExcelInfo.Location + "' and [VALID_FLAG] = 1) " + "insert into [LES].[TM_BAS_LOCATION] (" + "[FID]," + insertFieldString + "[CREATE_USER]," + "[CREATE_DATE]," + "[VALID_FLAG]" + ") values (" + "NEWID()," ///FID + insertValueString + "N'" + loginUser + "'," ///CREATE_USER + "GETDATE()," ///CREATE_DATE + "1" ///VALID_FLAG + ");"; continue; } /// if (string.IsNullOrEmpty(locationExcelInfo.LocationName) || string.IsNullOrEmpty(locationExcelInfo.Plant)) { throw new Exception("MC:0x00000222");///工位代码、名称、对应工厂为必填项 } ///值 string valueString = string.Empty; for (int i = 0; i < fields.Count; i++) { string valueStr = CommonDAL.GetFieldValueForSql <LocationInfo>(locationExcelInfo, fields[i]); if (string.IsNullOrEmpty(valueStr)) { throw new Exception("MC:1x00000043");///数据格式不符合导入规范 } valueString += "[" + fieldNames[fields[i]] + "] = " + valueStr + ","; } sql += "update [LES].[TM_BAS_LOCATION] set " + valueString + "[MODIFY_USER] = N'" + loginUser + "'," + "[MODIFY_DATE] = GETDATE() " + "where [ID] = " + locationInfo.Id + ";"; } /// if (string.IsNullOrEmpty(sql)) { return(false); } return(CommonDAL.ExecuteNonQueryBySql(sql)); }
public void TestInsertEmployeeLeaveSummary() { // Insert an employee role Role employeeRole = Role.CreateRole(Guid.NewGuid().ToString()); employeeRole.Save(); // Insert an employee. Employee employee = Employee.CreateEmployee(Guid.NewGuid().ToString(), "123", Sex.Male, "Tian", DateTime.Now, "Liu"); employee.IsActive = true; employee.ServiceYears = 10; List <EmployeeRoleRL> employeeRoleList = new List <EmployeeRoleRL>(); employeeRoleList.Add(EmployeeRoleRL.CreateEmployeeRoleRL(Guid.Empty, employeeRole.PKRoleID)); employee.SetRoleList(employeeRoleList); employee.Save(); Guid employeeGuid = employee.PKEmployeeID; // Insert a leave type DateTime leaveTypeStartTime = Convert.ToDateTime("01/01/2000"); DateTime leaveTypeEndTime = Convert.ToDateTime("01/01/3000"); LeaveType leaveType1 = LeaveType.CreateLeaveType(Guid.NewGuid().ToString(), 100, leaveTypeStartTime, leaveTypeEndTime); leaveType1.PKLeaveTypeID = Guid.NewGuid(); leaveType1.SetKnowledgeDate(DateTime.Now); leaveType1.Save(); Guid leaveTypeGuid = leaveType1.PKLeaveTypeID; // Insert another leave type DateTime secLeaveTypeStartTime = Convert.ToDateTime("01/01/2010"); DateTime secLeaveTypeEndTime = Convert.ToDateTime("01/01/3010"); LeaveType leaveType2 = LeaveType.CreateLeaveType(Guid.NewGuid().ToString(), 200, secLeaveTypeStartTime, secLeaveTypeEndTime); leaveType2.PKLeaveTypeID = Guid.NewGuid(); leaveType2.SetKnowledgeDate(DateTime.Now); leaveType2.Save(); Guid secleaveTypeGuid = leaveType2.PKLeaveTypeID; // Insert an employee leave summary EmployeeLeaveSummary employeeLeaveSummary = EmployeeLeaveSummary.CreateEmployeeLeaveSummary(employeeGuid, leaveTypeGuid, DateTime.Now.Year); employeeLeaveSummary.PKELSID = Guid.NewGuid(); employeeLeaveSummary.UsedHours = 10; employeeLeaveSummary.Save(); Guid summaryGuid = employeeLeaveSummary.PKELSID; // Get the inserted employee leave summary List <SearchCondition> conditions = new List <SearchCondition>(); conditions.Add(SearchCondition.CreateSearchCondition("PKELSID", summaryGuid.ToString(), SearchComparator.Equal, SearchType.SearchString)); EmployeeLeaveSummary testSummary = CommonDAL <EmployeeLeaveSummary> .GetSingleObject(conditions); Assert.AreEqual(testSummary.FKEmployeeID, employeeLeaveSummary.FKEmployeeID); // Delete inserted items employeeLeaveSummary.Delete(); leaveType1.Delete(); leaveType2.Delete(); employee.Delete(); employeeRole.Delete(); }
/// <summary> /// 修改表中某字段值 /// </summary> /// <param name="tableName">表名</param> /// <param name="columnName">字段名</param> /// <param name="columnValue">字段值</param> /// <param name="where">条件</param> /// <returns></returns> public static bool Update(string tableName, string columnName, object columnValue, string where) { int obj = CommonDAL.Update(tableName, columnName, columnValue.ToString(), where); return(obj > 0); }
public ModuleInfoDAL() { _commonDAL = new CommonDAL<T_PF_MODULEINFO>(); }
private void GetBindData(List <ShowAndPendOrderDataInfo> lstShowAndPendOrderDataInfos, string orderType, int iDriver, bool isSaveOrder) { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); CommonDAL.ShowMessage(this); var lstDb = from sPod in lstShowAndPendOrderDataInfos where !sPod.IsPaid.Equals(@"Y") && !sPod.IsCancel.Equals(@"Y") select new { ID = sPod.ID, CheckCode = sPod.CheckCode, OrderTime = sPod.PayTime, PostCode = string.IsNullOrEmpty(sPod.CustPostCode) ? "" : sPod.CustPostCode, PostCodeZone = string.IsNullOrEmpty(sPod.CustPcZone) ? "" : sPod.CustPcZone, Addr = string.IsNullOrEmpty(sPod.CustAddr) ? "" : sPod.CustAddr, PayOrderType = sPod.PayOrderType, CustomerName = string.IsNullOrEmpty(sPod.CustName) ? "" : sPod.CustName, CustomerPhone = string.IsNullOrEmpty(sPod.CustPhone) ? "" : sPod.CustPhone, IsPaid = sPod.IsPaid, TotalAmount = sPod.TotalAmount, StaffName = string.IsNullOrEmpty(sPod.UsrName) ? "" : sPod.UsrName, Paid = string.IsNullOrEmpty(sPod.Paid) ? "" : sPod.Paid, CustID = Convert.ToInt32(sPod.CustID), DriverID = sPod.DriverID, DriverName = string.IsNullOrEmpty(sPod.DriverName) ? "" : sPod.DriverName, MenuAmount = sPod.MenuAmount, Discount = string.IsNullOrEmpty(sPod.PayDiscount) ? "" : sPod.PayDiscount, DiscountPer = string.IsNullOrEmpty(sPod.PayPerDiscount) ? "" : sPod.PayPerDiscount, IsSave = string.IsNullOrEmpty(sPod.IsSave) ? "" : sPod.IsSave, OtherCheckCode = !sPod.IsSave.Equals("N") ? " " : sPod.CheckCode, gridBusDate = sPod.BusDate, gridRefNum = string.IsNullOrEmpty(sPod.RefNum) ? "" : sPod.RefNum, gridDeliveryFee = string.IsNullOrEmpty(sPod.DeliveryFee) ? "" : sPod.DeliveryFee, gridSurcharge = string.IsNullOrEmpty(sPod.PaySurcharge) ? "" : sPod.PaySurcharge }; if (isSaveOrder) { lstDb = lstDb.Where(s => s.IsSave.Equals("Y")); } var lstTmp = lstDb; switch (iDriver) { case 1: lstTmp = lstDb.Where(s => !string.IsNullOrEmpty(s.DriverName)); break; case 2: lstTmp = lstDb.Where(s => string.IsNullOrEmpty(s.DriverName)); break; default: lstTmp = lstDb; break; } gridControlTaPendOrder.DataSource = !string.IsNullOrEmpty(orderType) ? lstTmp.Where(s => s.PayOrderType.Equals(orderType) && string.IsNullOrEmpty(s.DriverName)).ToList() : lstTmp.ToList(); gvTaPendOrder.FocusedRowHandle = gvTaPendOrder.RowCount - 1; gvTaPendOrder.Columns["OrderTime"].BestFit(); txtTotal.Text = lstTmp.Sum(s => Convert.ToDecimal(string.IsNullOrEmpty(s.TotalAmount) ? "0.00" : s.TotalAmount)).ToString(); if (!string.IsNullOrEmpty(strOrderNo) && !string.IsNullOrEmpty(strBusDate) && !string.IsNullOrEmpty(strCustPhone)) { if (gvTaPendOrder.FocusedRowHandle >= 0) { for (int i = 0; i < gvTaPendOrder.RowCount; i++) { string colValue = gvTaPendOrder.GetRowCellValue(i, "CheckCode").ToString(); if (colValue.Equals(strCustPhone)) { gvTaPendOrder.FocusedRowHandle = i; break; } } } } sw.Stop(); TimeSpan ts = sw.Elapsed; LogHelper.Info(@"FrmTaPendOrder GetBindData Time " + ts.TotalMilliseconds); CommonDAL.HideMessage(this); }