예제 #1
0
        public void Carry(int orderId, int senderId)
        {
            //派送。

            TransactionHelper.BeginTransaction();
            var serialNo = SerialNoHelper.Create();
            var item     = this.OrderService.QueryOrder(new OrderRequest()
            {
                Serialnumber = orderId
            }).FirstOrDefault();

            if (item != null)
            {
                if (item.State == OrderState.Normal)
                {
                    var user = MembershipService.GetUserById(senderId);
                    item.State      = OrderState.Carry;
                    item.SenderId   = senderId;
                    item.Sender     = user.DisplayName;
                    item.SubmitTime = DateTime.Now;
                    OrderService.UpdateOrder(item);
                    Logger.LogWithSerialNo(LogTypes.EditOrder, serialNo, item.Serialnumber, item.OrderId);
                    AddMessage("Update.success", item.OrderId);
                }
                else
                {
                    AddError("当前状态不能进入派送阶段", item.OrderId);
                }
            }
            TransactionHelper.Commit();
        }
예제 #2
0
        EntityDiff()
        {
            Editor ed = AcadApp.Application.DocumentManager.MdiActiveDocument.Editor;

            PromptEntityResult res = ed.GetEntity("\nSelect first entity");

            if (res.Status != PromptStatus.OK)
            {
                return;
            }
            ObjectId objId1 = res.ObjectId;

            res = ed.GetEntity("\nSelect second entity");
            if (res.Status != PromptStatus.OK)
            {
                return;
            }
            ObjectId objId2 = res.ObjectId;

            using (TransactionHelper trHlp = new TransactionHelper()) {
                trHlp.Start();

                EntityDiff dbox = new EntityDiff(objId1, objId2, trHlp);
                dbox.Text = "Diff Objects";
                AcadApp.Application.ShowModalDialog(dbox);

                trHlp.Commit();
            }
        }
예제 #3
0
        /// <summary>
        /// 删除周期
        /// </summary>
        /// <param name="cycleID"></param>
        public void Delete(Guid cycleID, out string res)
        {
            #region  除限制判断
            if (new DataOperateBLL(CurrentUserInfo).CycleDeleteCheck(cycleID, out res) != 0)
            {
                return;
            }
            #endregion

            IDbTransaction tran = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();
            using (tran.Connection)
            {
                try
                {
                    this._currentDAO.Delete(cycleID, tran);

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }
        }
예제 #4
0
        public ResultMsg Delete(int id)
        {
            ResultMsg msg = new ResultMsg();

            try
            {
                TransactionHelper.BeginTransaction();
                var distributor = DistributorService.GetById(id);
                if (distributor != null)
                {
                    //把下属经销商的上级设为要删除的经销商的上级。
                    List <Distributor> list = DistributorService.GetByParentId(id);
                    foreach (var item in list)
                    {
                        if (item != null)
                        {
                            //var user1 = MembershipService.GetUserById(item.UserId);
                            item.ParentId = distributor.ParentId;
                            //TransactionHelper.BeginTransaction();
                            // MembershipService.DeleteUser(user1);
                            DistributorService.Update(item);

                            Logger.LogWithSerialNo(LogTypes.DistributorEdit, SerialNoHelper.Create(), id, item.Name);
                            AddMessage("update.success", item.Name);
                            //TransactionHelper.Commit();

                            CacheService.Refresh(CacheKeys.DistributorKey);
                        }
                    }
                    var accounts = AccountService.Query(new AccountRequest()).Where(x => x.DistributorId == id);
                    foreach (var account in accounts)
                    {
                        account.DistributorId = distributor.ParentId;
                        AccountService.Update(account);
                    }
                    var user = MembershipService.GetUserById(distributor.UserId);
                    MembershipService.DeleteUser(user);
                    DistributorService.Delete(distributor);

                    Logger.LogWithSerialNo(LogTypes.DistributorDelete, SerialNoHelper.Create(), id, user.Name);
                    //AddMessage("delete.success", user.Name);
                    msg.Code     = 1;
                    msg.CodeText = "删除 " + user.DisplayName + " 成功";
                    TransactionHelper.Commit();

                    CacheService.Refresh(CacheKeys.PosKey);
                }
                else
                {
                    msg.CodeText = "不好意思,没有找到经销商";
                }
                return(msg);
            }
            catch (Exception ex)
            {
                msg.CodeText = "不好意思,系统异常";
                Logger.Error("删除经销商", ex);
                return(msg);
            }
        }
예제 #5
0
        /// <summary>
        /// 编辑拜访任务
        /// </summary>
        /// <param name="entity"></param>
        public void EditTask(VisitingTaskEntity entity)
        {
            IDbTransaction tran = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    VisitingTaskEntity oldEntity = this._currentDAO.GetByID(entity.VisitingTaskID);
                    if (oldEntity.POPType == entity.POPType)
                    {
                        this._currentDAO.Update(entity, tran);
                    }
                    else
                    {
                        new VisitingPOPMappingDAO(CurrentUserInfo).DeleteVisitingPOPAll(entity.VisitingTaskID.Value, tran);
                        this._currentDAO.Update(entity, tran);
                    }

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }
        }
예제 #6
0
        Layer()
        {
            m_db = Utils.Db.GetCurDwg();
            string symName = "Jimbo";

            using (TransactionHelper tr = new TransactionHelper(m_db)) {
                tr.Start();

                if (tr.SymbolTableRecExists(typeof(LayerTableRecord), symName))
                {
                    Utils.AcadUi.PrintToCmdLine(string.Format("\nLayer \"{0}\" already exists.", symName));
                    return;
                }

                LayerTableRecord lyr = new LayerTableRecord();
                lyr.Name             = symName;
                lyr.LinetypeObjectId = Utils.SymTbl.GetOrLoadLinetypeId("ZIGZAG", m_db);
                //lyr.Description = "Layer created programmatically by MgdDbg"; // Can't set until after its added to the database!

                lyr.Color = Color.FromRgb(0, 130, 160);

                tr.AddNewSymbolRec(lyr);

                tr.Commit();
                Utils.AcadUi.PrintToCmdLine(string.Format("\nCreated layer \"{0}\".", symName));
            }
        }
예제 #7
0
        /// <summary>
        /// 修磨确认
        /// </summary>
        /// <param name="id">主键</param>
        ///  <param name="num">总支数</param>
        /// <param name="factNum">修磨支数</param>
        /// <param name="xmbz">修磨标准</param>
        /// <param name="sta">工位</param>
        /// <param name="remark">说明</param>
        /// <param name="emp">修磨人</param>
        /// <param name="hg">货管</param>
        /// <param name="batchNo">批次号</param>
        /// <param name="slbwhCode">仓库编码</param>
        /// <param name="grinWheel">砂轮</param>
        /// <returns></returns>
        public string RegroundConfirm(string id, string num, string factNum, string xmbz,
                                      string sta, string remark, string emp, string hg, string batchNo, string quality, string hw,
                                      string slbwhCode, string grinWheel, string group, string shift, DateTime operation, string area)
        {
            string result = "1";

            TransactionHelper.BeginTransaction();
            try
            {
                Mod_TRC_PLAN_REGROUND_HANDLER model = new Mod_TRC_PLAN_REGROUND_HANDLER();
                model.C_REGROUND_ID    = id;
                model.C_EMP_NAME       = emp;
                model.C_STA_ID         = sta;
                model.C_XMBZ           = xmbz;
                model.N_TOTAL_QUA      = int.Parse(num);
                model.N_QUA            = int.Parse(factNum);
                model.C_BATCH_NO       = batchNo;
                model.C_QUALITY        = quality;
                model.C_HW             = hw;
                model.C_HG             = hg;
                model.N_STATUS         = 1;
                model.C_CAUSE          = remark;
                model.C_GRINDING_WHEEL = grinWheel;
                model.C_SHIFT          = shift;
                model.C_GROUP          = group;
                model.D_DT             = operation;
                if (!handlerDal.Add(model))
                {
                    TransactionHelper.RollBack();
                    return("0");
                }


                string columnName = "";
                if (area == "1")
                {
                    columnName = General.NameType[xmbz];
                }
                else
                {
                    columnName = General.NameTypes[xmbz];
                }

                if (!dal.UpdateRegroundProcedure(id, columnName, int.Parse(factNum), 1))
                {
                    TransactionHelper.RollBack();
                    return("0");
                }

                TransactionHelper.Commit();

                dal.UpdateRegroundType();
            }
            catch (Exception ex)
            {
                TransactionHelper.RollBack();
                return("0");
            }
            return(result);
        }
예제 #8
0
        BrowseReflection(ObjectId objId)
        {
            if (objId.IsNull)
            {
                Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("ObjectId == null");
                return;
            }

            if (objId.IsValid == false)
            {
                Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("ObjectId not valid");
                return;
            }

            using (TransactionHelper tr = new TransactionHelper(objId.Database)) {
                tr.Start();

                DBObject tmpObj = tr.Transaction.GetObject(objId, OpenMode.ForRead);
                MgdDbg.Snoop.Forms.GenericPropGrid pgForm = new MgdDbg.Snoop.Forms.GenericPropGrid(tmpObj);
                pgForm.Text = MgdDbg.Utils.AcadUi.ObjToTypeAndHandleStr(tmpObj);
                pgForm.ShowDialog();

                tr.Commit();
            }
        }
예제 #9
0
        public void EditCDP(CallDayPlanningEntity entity, string poplist)
        {
            CallDayPlanningViewEntity_POP searchEntity = new CallDayPlanningViewEntity_POP();

            searchEntity.ClientUserID = entity.ClientUserID;
            searchEntity.CallDate     = entity.CallDate;
            CallDayPlanningEntity[] oldEntity = this._currentDAO.GetCallDayPlanning(searchEntity);

            IDbTransaction tran = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    foreach (string popid in poplist.Split(','))
                    {
                        if (!string.IsNullOrEmpty(popid) &&
                            oldEntity.Where(m => m.POPID == popid).ToArray().Length == 0)
                        {
                            entity.PlanningID = null;
                            entity.POPID      = popid;
                            this._currentDAO.Create(entity, tran);
                        }
                    }

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }
        }
예제 #10
0
        References(string label, AcDb.ObjectId val)
            :   base(label)
        {
            m_val = val;

            if (m_val.IsNull == false)
            {
                using (TransactionHelper trHlp = new TransactionHelper(m_val.Database)) {
                    trHlp.Start();

                    AcDb.DBObject dbObj = trHlp.Transaction.GetObject(m_val, AcDb.OpenMode.ForRead);

                    MgdDbg.Utils.ReferenceFiler filer = new MgdDbg.Utils.ReferenceFiler();
                    dbObj.DwgOut(filer);

                    trHlp.Commit();

                    m_hardPointerIds   = filer.m_hardPointerIds;
                    m_softPointerIds   = filer.m_softPointerIds;
                    m_hardOwnershipIds = filer.m_hardOwnershipIds;
                    m_softOwnershipIds = filer.m_softOwnershipIds;
                }

                if ((m_hardPointerIds.Count == 0) && (m_softPointerIds.Count == 0) && (m_hardOwnershipIds.Count == 0) && (m_softOwnershipIds.Count == 0))
                {
                    m_hasRefs = false;
                }
                else
                {
                    m_hasRefs = true;
                }
            }
        }
예제 #11
0
파일: Db.cs 프로젝트: zhengjian211/MgdDbg
        CloneAndXformObjects(Database db, ObjectIdCollection entsToClone,
                             ObjectId ownerBlockId, Matrix3d xformMat)
        {
            using (TransactionHelper trHlp = new TransactionHelper(db)) {
                trHlp.Start();

                IdMapping idMap = new IdMapping();
                db.DeepCloneObjects(entsToClone, ownerBlockId, idMap, false);

                // walk through all the cloned objects and Xform any of the entities
                foreach (IdPair idpair in idMap)
                {
                    if (idpair.IsCloned)
                    {
                        DBObject clonedObj = trHlp.Transaction.GetObject(idpair.Value, OpenMode.ForWrite);
                        Entity   clonedEnt = clonedObj as Entity;
                        if (clonedEnt != null)
                        {
                            clonedEnt.TransformBy(xformMat);
                        }
                    }
                }

                trHlp.Commit();
            }
        }
예제 #12
0
        /// <summary>
        /// 装车
        /// </summary>
        /// <returns></returns>
        public string Loading(DataRow dr, int num, string slabwhCode, string shift, string group, string remark)
        {
            string result = "1";

            try
            {
                TransactionHelper.BeginTransaction();

                string   strUserID = RV.UI.UserInfo.userID;
                DateTime time      = RV.UI.ServerTime.timeNow();

                DataTable billet = new DataTable();
                if (dal.UpdateLodingType(dr["C_STOVE"].ToString(), dr["C_STL_GRD"].ToString(), dr["C_SPEC"].ToString(), dr["C_STD_CODE"].ToString(), dr["C_MAT_CODE"].ToString(), num, slabwhCode, shift, group, strUserID, time, out billet, dr["C_BATCH_NO"].ToString(), remark) != num)
                {
                    TransactionHelper.RollBack();
                    return("装车失败");
                }


                TransactionHelper.Commit();
            }
            catch (Exception ex)
            {
                TransactionHelper.RollBack();
                return(ex.Message);
            }

            return(result);
        }
예제 #13
0
        /// <summary>
        /// 删除修磨记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string DelRegroundHandler(string id, string regroundid, string xmbz, string qua)
        {
            string result = "1";

            TransactionHelper.BeginTransaction();
            try
            {
                string columnName = General.NameType[xmbz];
                if (!dal.DelRegroundHandler(id))
                {
                    return("0");
                }
                if (!dal.UpdateRegroundProcedure(regroundid, columnName, int.Parse(qua), 2))
                {
                    return("0");
                }
                TransactionHelper.Commit();
                dal.UpdateRegroundType();
            }
            catch (Exception ex)
            {
                TransactionHelper.RollBack();
                return("0");
            }
            dal.ResetRegroundQua();
            return(result);
        }
예제 #14
0
        Block()
        {
            m_db = Utils.Db.GetCurDwg();
            string symName = "Jimbo";

            if (Utils.SymTbl.SymbolTableRecExists(typeof(BlockTableRecord), symName, m_db))
            {
                bool         answer;
                PromptStatus stat = Utils.AcadUi.PromptYesNo(string.Format("\nBlock \"{0}\"already exists. Replace?", symName), false, out answer);
                if ((stat != PromptStatus.OK) || (answer == false))
                {
                    return;
                }
            }

            using (TransactionHelper tr = new TransactionHelper(m_db)) {
                tr.Start();

                BlockTableRecord blkRec = tr.DefineNewBlockRec(symName);

                Line line = new Line(new Point3d(0.0, 0.0, 0.0), new Point3d(10.0, 10.0, 0.0));
                blkRec.AppendEntity(line);
                tr.Transaction.AddNewlyCreatedDBObject(line, true);

                Circle circ = new Circle();
                circ.Center = new Point3d(0.0, 0.0, 0.0);
                circ.Radius = 5.0;
                blkRec.AppendEntity(circ);
                tr.Transaction.AddNewlyCreatedDBObject(circ, true);

                tr.Commit();
                Utils.AcadUi.PrintToCmdLine(string.Format("\nCreated block \"{0}\".", symName));
            }
        }
예제 #15
0
        public void Complete(int id)
        {
            //完成订单。

            TransactionHelper.BeginTransaction();
            var serialNo = SerialNoHelper.Create();
            var item     = this.OrderService.QueryOrder(new OrderRequest()
            {
                Serialnumber = id
            }).FirstOrDefault();

            if (item != null)
            {
                if (item.State == OrderState.Partially || item.State == OrderState.Carry)
                {
                    item.State = OrderState.Completed;
                    OrderService.UpdateOrder(item);
                    Logger.LogWithSerialNo(LogTypes.EditOrder, serialNo, item.Serialnumber, item.OrderId);
                    AddMessage("Update.success", item.OrderId);
                }
                else
                {
                    AddError("当前状态不能进入完成状态", item.OrderId);
                }
            }
            TransactionHelper.Commit();
        }
예제 #16
0
        public void Save()
        {
            var serialNo  = SerialNoHelper.Create();
            var oldUser   = MembershipService.GetUserById(InnerObject.UserId);
            var adminUser = oldUser as AdminUser;

            if (adminUser == null)
            {
                return;
            }
            TransactionHelper.BeginTransaction();

            adminUser.Email       = Email;
            adminUser.DisplayName = DisplayName;
            if (!string.IsNullOrEmpty(Password))
            {
                adminUser.SetPassword(Password);
            }
            adminUser.BirthDate = BirthDate;
            adminUser.Mobile    = Mobile;
            //adminUser.IsSale = IsSale;
            var roleIds = Roles.GetCheckedIds();

            MembershipService.UpdateUser(adminUser);
            OnSaved(adminUser);
            MembershipService.DeleteRolesForUser(adminUser.UserId);
            MembershipService.AssignRoles(adminUser, roleIds);
            AddMessage("success", oldUser.Name);
            Logger.LogWithSerialNo(LogTypes.AdminUserEdit, serialNo, adminUser.UserId, oldUser.Name);
            TransactionHelper.Commit();
        }
예제 #17
0
        public ResultMessage UpdShoppingCartQuantity(int commodityId, int shoppingCartId, int quantity)
        {
            try
            {
                //TransactionHelper.BeginTransaction();
                var ShoppingCart = ShoppingCartService.GetById(shoppingCartId);
                if (ShoppingCart != null)
                {
                    var commodity = JuMeiMallService.GetById(commodityId);
                    if (commodity != null)//检测商品信息
                    {
                        if (commodity.commodityState == CommodityStates.soldOut)
                        {
                            return new ResultMessage()
                                   {
                                       Code = -1, Msg = "商品已下架,请重新生成订单!"
                                   }
                        }
                        ;
                    }
                    else
                    {
                        return(new ResultMessage()
                        {
                            Code = -1, Msg = "商品不存在,请重新生成购物车!"
                        });
                    }



                    if (commodity.commodityInventory < quantity)
                    {
                        ShoppingCart.quantity = commodity.commodityInventory;
                        ShoppingCartService.Update(ShoppingCart);
                        TransactionHelper.Commit();
                        return(new ResultMessage()
                        {
                            Code = -1, Msg = string.Format("{0}库存不足,此商品库存剩余{1}件", commodity.commodityName, commodity.commodityInventory), quantity = commodity.commodityInventory
                        });
                    }

                    ShoppingCart.quantity = quantity;
                    ShoppingCartService.Update(ShoppingCart);
                }
                // TransactionHelper.Commit();
                return(new ResultMessage()
                {
                    Code = 0, Msg = "购物车修改数量成功"
                });
            }
            catch (Exception ex)
            {
                logService.Insert(ex);
                return(new ResultMessage()
                {
                    Code = -1, Msg = "购物车数量修改-网络错误,请稍后重试..."
                });
            }
        }
        /// <summary>
        /// 路线地图选择终端
        /// </summary>
        /// <param name="routeid"></param>
        /// <param name="mappingEntity"></param>
        /// <param name="deletelist">删除的ID集合(不要含用户后来又选择的)</param>
        public void EditUserCDPPOPMap_Store(CallDayPlanningViewEntity_POP infoEntity, List <DefindControlEntity> pSearch, CallDayPlanningViewEntity_POP[] mappingEntity, string deletelist)
        {
            IDbTransaction tran = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    List <CallDayPlanningEntity> oldList = this._currentDAO.GetCallDayPlanning(infoEntity).ToList();

                    for (int i = 0; i < mappingEntity.Length; i++)
                    {
                        CallDayPlanningViewEntity_POP entity = mappingEntity[i];

                        if (entity.MappingID != null && !string.IsNullOrEmpty(entity.MappingID.ToString()))
                        {
                            //修改
                            CallDayPlanningEntity uEntity = oldList.Where(m => m.PlanningID == entity.MappingID).ToArray()[0];
                            uEntity.Sequence = (i + 1);
                            this._currentDAO.Update(uEntity, tran);
                        }
                        else
                        {
                            //新增
                            CallDayPlanningEntity uEntity = new CallDayPlanningEntity();

                            uEntity.CallDate     = infoEntity.CallDate;
                            uEntity.POPID        = entity.StoreID.ToString().ToLower();
                            uEntity.POPType      = 1;
                            uEntity.ClientUserID = infoEntity.ClientUserID;
                            uEntity.Sequence     = (i + 1);
                            uEntity.PlanningType = 2;

                            uEntity.ClientID            = Convert.ToInt32(CurrentUserInfo.ClientID);
                            uEntity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID);
                            this._currentDAO.Create(uEntity, tran);
                        }
                    }
                    //删除
                    if (deletelist != null && !string.IsNullOrEmpty(deletelist))
                    {
                        foreach (string mapid in deletelist.Split(','))
                        {
                            if (!string.IsNullOrEmpty(mapid))
                            {
                                this._currentDAO.Delete(Guid.Parse(mapid), tran);
                            }
                        }
                    }

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }
        }
        /// <summary>
        /// 路线地图选择终端
        /// </summary>
        /// <param name="routeid"></param>
        /// <param name="mappingEntity"></param>
        /// <param name="deletelist">删除的ID集合(不要含用户后来又选择的)</param>
        public void EditRoutePOPMap_Distributor(Guid routeid, RoutePOPMappingViewEntity[] mappingEntity, string deletelist)
        {
            IDbTransaction tran = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    for (int i = 0; i < mappingEntity.Length; i++)
                    {
                        RoutePOPMappingViewEntity entity = mappingEntity[i];

                        if (entity.MappingID != null && !string.IsNullOrEmpty(entity.MappingID.ToString()))
                        {
                            //修改
                            RoutePOPMappingEntity uEntity = new RoutePOPMappingEntity();
                            uEntity.MappingID           = entity.MappingID;
                            uEntity.RouteID             = routeid;
                            uEntity.POPID               = entity.DistributorID.ToString();
                            uEntity.Sequence            = (i + 1);
                            uEntity.ClientID            = Convert.ToInt32(CurrentUserInfo.ClientID);
                            uEntity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID);
                            this._currentDAO.Update(uEntity, tran);
                        }
                        else
                        {
                            //新增
                            RoutePOPMappingEntity uEntity = new RoutePOPMappingEntity();
                            uEntity.RouteID             = routeid;
                            uEntity.POPID               = entity.DistributorID.ToString();
                            uEntity.Sequence            = (i + 1);
                            uEntity.ClientID            = Convert.ToInt32(CurrentUserInfo.ClientID);
                            uEntity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID);
                            this._currentDAO.Create(uEntity, tran);
                        }
                    }
                    //删除
                    if (deletelist != null && !string.IsNullOrEmpty(deletelist))
                    {
                        foreach (string mapid in deletelist.Split(','))
                        {
                            if (!string.IsNullOrEmpty(mapid))
                            {
                                this._currentDAO.Delete(Guid.Parse(mapid), tran);
                            }
                        }
                    }

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }

            new RouteBLL(CurrentUserInfo).GenerateCallDayPlanning(routeid);
        }
예제 #20
0
        public ResultMessage Refund(string orderNo)
        {
            Load();
            if (UserInformation == null)
            {
                return new ResultMessage()
                       {
                           Code = -1, Msg = "请重新登录"
                       }
            }
            ;
            TransactionHelper.BeginTransaction();
            var order = OrderService.GetOrderNo(orderNo);

            if (order == null)
            {
                return new ResultMessage()
                       {
                           Code = -1, Msg = "订单不存在"
                       }
            }
            ;
            if (order.orderState != OrderStates.complete && order.orderState != OrderStates.paid)
            {
                return new ResultMessage()
                       {
                           Code = -1, Msg = "订单状态不正确"
                       }
            }
            ;
            order.orderState = OrderStates.applyRefund;
            //if (Account != null)
            //{
            //    if (Account.salerId > 0)
            //    {
            //        var salerAccount = AccountService.GetByUserId(Account.salerId);
            //        if (salerAccount != null)
            //        {
            //            var amount = order.payAmount * RebateRatio;
            //            salerAccount.activatePoint += amount;
            //            OperationPointLog log = new OperationPointLog();
            //            log.account = "activatePoint";
            //            log.point = amount;
            //            log.remark = string.Format("{0}消费", UserInformation.Name);
            //            log.submitTime = DateTime.Now;
            //            log.userId = UserInformation.UserId;
            //            OperationPointLogService.Insert(log);
            //        }
            //    }
            //}
            OrderService.Update(order);
            TransactionHelper.Commit();
            return(new ResultMessage()
            {
                Code = 0
            });
        }
    }
}
        /// <summary>
        /// 撤销轧钢计划(中间表撤回)
        /// </summary>
        /// <param name="strID">trp_plan_roll_item_info表主键</param>
        public string BackPlan(string strID)
        {
            try
            {
                string result = "1";

                TransactionHelper.BeginTransaction();

                Mod_TRP_PLAN_ROLL_ITEM_INFO modItemInfo = dal.GetModel(strID);
                if (modItemInfo != null)
                {
                    if (modItemInfo.N_STATUS != 1)
                    {
                        TransactionHelper.RollBack();
                        return("撤销失败!");
                    }

                    if (!dal.Delete_Trans(strID))
                    {
                        TransactionHelper.RollBack();
                        return("撤销失败!");
                    }

                    Mod_TRP_PLAN_ROLL modPlan = dalTrpPlanRoll.GetModel(modItemInfo.C_PLAN_ROLL_ID);
                    if (modPlan == null)
                    {
                        TransactionHelper.RollBack();
                        return("撤销失败!");
                    }
                    else
                    {
                        modPlan.N_STATUS    = 0;
                        modPlan.N_ISSUE_WGT = modPlan.N_ISSUE_WGT - Convert.ToDecimal(modItemInfo.N_ISSUE_WGT);

                        if (!dalTrpPlanRoll.Update_Trans(modPlan))
                        {
                            TransactionHelper.RollBack();
                            return("撤销失败!");
                        }
                    }
                }
                else
                {
                    TransactionHelper.RollBack();
                    return("撤销失败!");
                }

                TransactionHelper.Commit();

                return(result);
            }
            catch
            {
                TransactionHelper.RollBack();
                return("撤销失败!");
            }
        }
예제 #22
0
        /// <summary>
        /// 设置自审信息
        /// </summary>
        /// <param name="cityId">城市</param>
        /// <param name="companyId">企业</param>
        /// <param name="allotId">任务ID</param>
        /// <param name="datType">任务数据类型</param>
        /// <param name="userName">自审人</param>
        /// <param name="pass">是否通过</param>
        /// <param name="remark">自审说明</param>
        /// <param name="message"></param>
        /// <param name="_db"></param>
        /// <param name="tx"></param>
        /// <returns></returns>
        public static int SetMyCheckInfo(int cityId, int companyId, long allotId, long datId, int datType, string userName, bool pass, string remark, out string message, DataBase _db = null, ITransaction tx = null)
        {
            message = "";
            DataBase          db = new DataBase(_db);
            TransactionHelper tr = new TransactionHelper(db.DB, tx);

            try
            {
                bool     add = false;
                DatCheck obj = GetCheckByAllotId(allotId, db);
                //是否存在数据
                if (obj == null)
                {
                    add              = true;
                    obj              = new DatCheck();
                    obj.CityId       = cityId;
                    obj.FxtCompanyId = companyId;
                    obj.AllotId      = allotId;
                    obj.DatType      = datType;
                    obj.DatId        = datId;
                }
                obj.CheckUserName1 = userName;
                obj.CheckState1    = SYSCodeManager.STATECODE_7;
                if (pass)
                {
                    obj.CheckState1 = SYSCodeManager.STATECODE_6;
                }
                obj.CheckRemark1 = remark;
                obj.CheckDate1   = DateTime.Now;
                bool upResult = false;
                if (add)
                {
                    upResult = db.DB.Create(obj, tx);
                }
                else
                {
                    upResult = db.DB.Update(obj, tx);
                }
                if (!upResult)
                {
                    tr.Rollback();
                    db.Close();
                    return(0);
                }
                tr.Commit();
                db.Close();
            }
            catch (Exception ex)
            {
                tr.Rollback();
                db.Close();
                message = "系统异常";
                log.Error("SetMyCheckInfo:系统异常", ex);
                return(-1);
            }
            return(1);
        }
        /// <summary>
        /// 拜访计划终端选择
        /// </summary>
        /// <param name="infoEntity">clientuserid,calldate 必传</param>
        /// <param name="pSearch"></param>
        /// <param name="mappingEntity"></param>
        public void EditUserCDPPOPList_Store(
            CallDayPlanningViewEntity_POP infoEntity,
            List <DefindControlEntity> pSearch,
            CallDayPlanningViewEntity_POP[] mappingEntity)
        {
            IDbTransaction tran = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    List <CallDayPlanningEntity> oldList = this._currentDAO.GetCallDayPlanning(infoEntity).ToList();

                    foreach (CallDayPlanningViewEntity_POP entity in mappingEntity)
                    {
                        if (entity.MappingID != null && !string.IsNullOrEmpty(entity.MappingID.ToString()))
                        {
                            if (entity.IsDelete == 1)
                            {
                                //删除
                                this._currentDAO.Delete(entity.MappingID, tran);
                            }
                            else
                            {
                                //修改
                                CallDayPlanningEntity uEntity = oldList.Where(m => m.PlanningID == entity.MappingID).ToArray()[0];
                                uEntity.Sequence = entity.Sequence;
                                this._currentDAO.Update(uEntity, tran);
                            }
                        }
                        else
                        {
                            //新增
                            CallDayPlanningEntity uEntity = new CallDayPlanningEntity();

                            uEntity.CallDate     = infoEntity.CallDate;
                            uEntity.POPID        = entity.StoreID.ToString().ToLower();
                            uEntity.POPType      = 1;
                            uEntity.ClientUserID = infoEntity.ClientUserID;
                            uEntity.Sequence     = entity.Sequence;
                            uEntity.PlanningType = 2;

                            uEntity.ClientID            = Convert.ToInt32(CurrentUserInfo.ClientID);
                            uEntity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID);
                            this._currentDAO.Create(uEntity, tran);
                        }
                    }

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }
        }
예제 #24
0
        XmlReport(string reportPath, string[] fnames)
        {
            XmlTextWriter stream = new XmlTextWriter(reportPath, System.Text.Encoding.UTF8);

            stream.Formatting  = Formatting.Indented;
            stream.IndentChar  = '\t';
            stream.Indentation = 1;

            stream.WriteStartDocument();
            stream.WriteStartElement("Drawings");

            foreach (string dwgPath in fnames)
            {
                // make sure everything is cleaned out in case they run this twice
                m_entities.Clear();
                m_objects.Clear();
                m_extDictIds.Clear();

                Utils.AcadUi.PrintToCmdLine(string.Format("\nProcessing drawing file: {0} ...", dwgPath));
                using (m_db = new Database(false, true)) {
                    m_db.ReadDwgFile(dwgPath, System.IO.FileShare.Read, true, null);

                    using (m_trHlp = new TransactionHelper(m_db)) {
                        m_trHlp.Start();

                        ProcessEntities();
                        ProcessObjects();

                        stream.WriteStartElement("Drawing");

                        stream.WriteAttributeString("path", dwgPath);

                        stream.WriteStartElement("Entities");
                        XmlReportRawEntityCount(stream);
                        XmlReportBlockDefs(stream);
                        stream.WriteEndElement();    // "Entities"

                        stream.WriteStartElement("Symbols");
                        XmlReportRawSymbolCount(stream);
                        XmlReportSymbolReferences(stream);
                        stream.WriteEndElement();    // "Symbols"

                        stream.WriteEndElement();    // "Drawing"

                        m_trHlp.Commit();
                    }

                    m_db.Dispose();
                }

                m_db = null;
            }

            stream.WriteEndElement();    // "Drawings"
            stream.WriteEndDocument();
            stream.Close();
        }
예제 #25
0
        /// <summary>
        ///撤销调拨处理
        /// </summary>
        /// <returns></returns>
        public string BackAllotHandler(string staID, string stove, string grd, string spec, string std,
                                       string matCode, int num)
        {
            string result = "1";

            try
            {
                TransactionHelper.BeginTransaction();

                DataTable billet = new DataTable();
                if (dal.BackAllotGrdType(staID, stove, grd, spec, std, matCode, num, out billet) != num)
                {
                    TransactionHelper.RollBack();
                    return("0");
                }

                if (dal.BackAllotUpdateCenter(billet) != num)
                {
                    TransactionHelper.RollBack();
                    return("0");
                }

                if (billet != null && billet.Rows.Count > 0)
                {
                    DateTime time = DateTime.Now;
                    foreach (DataRow item in billet.Rows)
                    {
                        Mod_TSC_ALLOT_LOG model = new Mod_TSC_ALLOT_LOG();
                        model.C_STL_GRD      = grd;
                        model.C_SPEC         = spec;
                        model.C_STD_CODE     = std;
                        model.C_MAT_CODE     = matCode;
                        model.C_STOVE        = stove;
                        model.C_SLAB_MAIN_ID = item["C_ID"].ToString();
                        model.C_STA_ID       = staID;
                        model.N_TYPE         = 3;
                        model.D_MOD_DT       = time;
                        model.C_EMP_ID       = RV.UI.UserInfo.userID;
                        if (!logDal.Add(model))
                        {
                            TransactionHelper.RollBack();
                            return("0");
                        }
                    }
                }

                TransactionHelper.Commit();
            }
            catch (Exception ex)
            {
                TransactionHelper.RollBack();
                return("0");
            }

            return(result);
        }
예제 #26
0
        /// <summary>
        /// 入库处理
        /// </summary>
        /// <param name="stove">炉号</param>
        /// <param name="num">支数</param>
        /// <param name="grd">钢种</param>
        /// <param name="std">执行标准</param>
        /// <param name="spec">规格</param>
        /// <param name="matCode">物料编码</param>
        /// <param name="area">区域</param>
        /// <param name="loc">库位</param>
        /// <param name="tier">层</param>
        /// <param name="shift">班次</param>
        /// <param name="group">班组</param>
        /// <param name="slabwhCode">仓库编码</param>
        /// <returns></returns>
        public string PutStoreHandler(string stove, int num, string grd, string std, string spec,
                                      string matCode, string area, string loc, string tier, string shift, string group, string slabwhCode)
        {
            string    result = "1";
            DataTable dt     = dal.GetPutData(stove, num, grd, std, spec, matCode, slabwhCode).Tables[0];

            try
            {
                TransactionHelper.BeginTransaction();

                if (dt == null && dt.Rows.Count == 0)
                {
                    return("0");
                }

                if (dal.AllotPutUpdateCenter(dt, slabwhCode, area, loc, tier) != num)
                {
                    TransactionHelper.RollBack();
                    return("0");
                }

                if (dal.AllotPutUpdateSlab(dt, slabwhCode, area, loc, tier, shift, group) != num)
                {
                    TransactionHelper.RollBack();
                    return("0");
                }

                DateTime time = DateTime.Now;
                foreach (DataRow item in dt.Rows)
                {
                    Mod_TSC_ALLOT_LOG model = new Mod_TSC_ALLOT_LOG();
                    model.C_STL_GRD      = grd;
                    model.C_SPEC         = spec;
                    model.C_STD_CODE     = std;
                    model.C_MAT_CODE     = matCode;
                    model.C_STOVE        = stove;
                    model.C_SLAB_MAIN_ID = item["C_SLAB_MAIN_ID"].ToString();
                    model.N_TYPE         = 2;
                    model.D_MOD_DT       = time;
                    model.C_EMP_ID       = RV.UI.UserInfo.userID;
                    if (!logDal.Add(model))
                    {
                        TransactionHelper.RollBack();
                        return("0");
                    }
                }
                TransactionHelper.Commit();
            }
            catch (Exception ex)
            {
                TransactionHelper.RollBack();
                return("0");
            }

            return(result);
        }
예제 #27
0
        AttachXref()
        {
            m_db = Utils.Db.GetCurDwg();
            if (m_db == null)
            {
                return;
            }

            string fileName = Utils.Dialog.OpenFileDialog(".dwg", "Choose dwg to attach as Xref", "Dwg files (*.dwg)|*.dwg");

            if (fileName.Length == 0)
            {
                return;
            }
            string blockName = System.IO.Path.GetFileNameWithoutExtension(fileName);

            if (blockName.Length == 0)
            {
                return;
            }
            if (blockName.ToLower() == System.IO.Path.GetFileNameWithoutExtension(Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Name).ToLower())
            {
                MessageBox.Show("External file name used could lead to a circular reference.", "MgdDbg", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            ObjectId objId = m_db.AttachXref(fileName, blockName);

            using (TransactionHelper trHlp = new TransactionHelper(m_db)) {
                trHlp.Start();

                BlockTableRecord btr    = (BlockTableRecord)trHlp.Transaction.GetObject(objId, OpenMode.ForRead);
                Database         xrefDb = btr.GetXrefDatabase(true);

                BlockTable blkTbl = (BlockTable)trHlp.Transaction.GetObject(m_db.BlockTableId, OpenMode.ForRead);

                ObjectIdCollection blkRecIds = new ObjectIdCollection();
                blkRecIds.Add(btr.ObjectId);

                foreach (ObjectId tblRecId in blkTbl)
                {
                    BlockTableRecord blkRec = (BlockTableRecord)trHlp.Transaction.GetObject(tblRecId, OpenMode.ForRead);
                    if (blkRec.Database == xrefDb)
                    {
                        blkRecIds.Add(tblRecId);
                    }
                }

                Snoop.Forms.DBObjects form = new Snoop.Forms.DBObjects(blkRecIds, trHlp);
                form.Text = "Xref Block Table Records";
                form.ShowDialog();
                trHlp.Commit();
            }
        }
        /// <summary>
        /// 路线列表选择终端
        /// </summary>
        /// <param name="routeid"></param>
        /// <param name="mappingEntity"></param>
        public void EditRoutePOPList_Distributor(Guid routeid, RoutePOPMappingViewEntity[] mappingEntity)
        {
            IDbTransaction tran = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    foreach (RoutePOPMappingViewEntity entity in mappingEntity)
                    {
                        if (entity.MappingID != null && !string.IsNullOrEmpty(entity.MappingID.ToString()))
                        {
                            if (entity.IsDelete == 1)
                            {
                                //删除
                                this._currentDAO.Delete(entity, tran);
                            }
                            else
                            {
                                //修改
                                RoutePOPMappingEntity uEntity = new RoutePOPMappingEntity();
                                uEntity.MappingID           = entity.MappingID;
                                uEntity.RouteID             = routeid;
                                uEntity.POPID               = entity.DistributorID.ToString();
                                uEntity.Sequence            = entity.Sequence;
                                uEntity.ClientID            = Convert.ToInt32(CurrentUserInfo.ClientID);
                                uEntity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID);
                                this._currentDAO.Update(uEntity, tran);
                            }
                        }
                        else
                        {
                            //新增
                            RoutePOPMappingEntity uEntity = new RoutePOPMappingEntity();
                            uEntity.RouteID             = routeid;
                            uEntity.POPID               = entity.DistributorID.ToString();
                            uEntity.Sequence            = entity.Sequence;
                            uEntity.ClientID            = Convert.ToInt32(CurrentUserInfo.ClientID);
                            uEntity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID);
                            this._currentDAO.Create(uEntity, tran);
                        }
                    }

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }

            new RouteBLL(CurrentUserInfo).GenerateCallDayPlanning(routeid);
        }
예제 #29
0
        ObjectDiff()
        {
            using (TransactionHelper trHlpr = new TransactionHelper()) {
                trHlpr.Start();

                ObjectDiff diff = new ObjectDiff(trHlpr);
                AcadApp.Application.ShowModalDialog(diff);

                trHlpr.Commit();
            }
        }
예제 #30
0
        public bool SetOrderIntegralInfo(OrderIntegralEntity pEntity, string customerId, out string res)
        {
            decimal integral        = this.itemService.GetItemIntegral(pEntity.ItemID);
            decimal integralAmmount = pEntity.Quantity.Value * integral;                              //使用积分
            decimal userIntegral    = ToDecimal(this.itemService.GetVipValidIntegral(pEntity.VIPID)); //用户剩余积分

            if (userIntegral - integralAmmount < 0)
            {
                res = "用户剩余积分不足";
                return(false);
            }

            IDbTransaction tran = new TransactionHelper(loggingSessionInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    /*插入订单积分、修改订单积分数据*/
                    //获取商品积分信息

                    pEntity.Integral        = integral;
                    pEntity.IntegralAmmount = integralAmmount;

                    new OrderIntegralBLL(loggingSessionInfo).Create(pEntity, tran);

                    VipIntegralBLL vipIntegralServer = new VipIntegralBLL(loggingSessionInfo);
                    vipIntegralServer.ProcessPoint(18, customerId, pEntity.VIPID, "", null, "", -integralAmmount);

                    //VipIntegralDetailEntity integralDetailEntity = new VipIntegralDetailEntity();
                    //integralDetailEntity.VipIntegralDetailID = Guid.NewGuid().ToString().Replace("-", "");
                    //integralDetailEntity.VIPID = pEntity.VIPID;
                    //integralDetailEntity.Integral = integralAmmount;
                    //integralDetailEntity.IntegralSourceID = "18";//兑礼减积分
                    //integralDetailEntity.CreateBy = "system";
                    //integralDetailEntity.EffectiveDate = DateTime.Now;
                    //integralDetailEntity.ObjectId = pEntity.OrderIntegralID;

                    //new VipIntegralDetailBLL(loggingSessionInfo).Create(integralDetailEntity, tran);

                    //this.itemService.UpdateVIPIntegral(userIntegral - integralAmmount, pEntity.VIPID, (SqlTransaction)tran);

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }
            res = "操作成功";
            return(true);
        }