/// <summary> /// 将员工改签店铺 /// </summary> /// <param name="UserID">用户ID</param> /// <param name="ShopID">店铺ID</param> /// <returns></returns> public bool UserChangeShop(Guid UserID, int ShopID) { using (TransactionScope TS = new TransactionScope()) { try { UserInShop new_UIS = new UserInShop(); //当有User在数据库中有值的时候才进行删除操作 bool Mark = true; try { new_UIS = DB_UserInShop.Select(P => P.UserID == UserID).Single(); } catch (Exception) { Mark = false; } if (Mark) { DB_UserInShop.Delete_NoSub(new_UIS); } DB_UserInShop.Insert_NoSub(new UserInShop() { UserID = UserID, ShopID = ShopID }); } catch (Exception) { } TS.Complete(); } return(true); }
/// <summary> /// 领工资 /// </summary> /// <param name="SalaryLogID">工资单号</param> /// <returns></returns> public bool GetSalary(int SalaryLogID, Guid UID, String RealName, decimal Price) { User_SalaryLog OldLog = DB_SalaryLog.Select(P => P.SalaryLog_ID == SalaryLogID).SingleOrDefault(); User_SalaryLog NewLog = OldLog; NewLog.SalaryLog_Mark = true; UserManager s = new UserManager(); int ShopID = s.SelectShopID_UserID(OldLog.SalaryLog_User); using (TransactionScope TS = new TransactionScope()) { try { DB_Account.dt = DB_SalaryLog.dt; DB_Account.Insert_NoSub(new Car_Account() { Account_Info = String.Format("这笔款项属于工资发放,店铺编号:{0},工资领取人:{1},工资领取时间:{2}", ShopID, RealName, DateTime.Now), Account_Price = Price, Account_Shop = ShopID, Account_Time = DateTime.Now, Account_User = UID }); DB_SalaryLog.Update_NoSub(OldLog, NewLog); DB_SalaryLog.dt.SubmitChanges(); TS.Complete(); return(true); } catch (Exception EX) { DB_Error.Insert(new Error() { Error_Messege = EX.Message, Error_Time = DateTime.Now }); return(false); } } }
/// <summary> /// 新增资金变动信息 /// </summary> /// <param name="CarGet">要增加的资金变动实体</param> /// <returns></returns> public bool AddCarGet_Trans(Car_Get CarGet) { return(DB_CarGet.Insert_NoSub(CarGet)); }
/// <summary> /// 新增资金变动信息 /// </summary> /// <param name="Account">要增加的资金变动实体</param> /// <returns></returns> public bool AddAccount_Trans(Car_Account Account) { return(DB_Account.Insert_NoSub(Account)); }