public void UpdateCurrentWorkingData(WorkingEntity workingEntity) { StringBuilder query = new StringBuilder(); var parameters = new List <SqlParameter>(); query.AppendLine("update"); query.AppendLine(" [KGWS].[dbo].[Working]"); query.AppendLine("set [isCurrent]='false'"); query.AppendLine("where"); query.AppendLine(" [workTitleId]=@workTitleId"); query.AppendLine("and"); query.AppendLine(" [workerId]=@workerId"); parameters.Clear(); parameters.Add(new SqlParameter("@workTitleId", workingEntity.WorkTitleId)); parameters.Add(new SqlParameter("@workerId", workingEntity.WorkerId)); SQLServerHelper.Execute(query.ToString(), parameters.ToArray()); query.Clear(); query.AppendLine("update"); query.AppendLine(" [KGWS].[dbo].[Working]"); query.AppendLine("set [isCurrent]='true'"); query.AppendLine("where"); query.AppendLine(" [workTitleId]=@workTitleId"); query.AppendLine("and"); query.AppendLine(" [workerId]=@workerId"); query.AppendLine("and"); query.AppendLine(" [workOpId]=@workOpId"); parameters.Clear(); parameters.Add(new SqlParameter("@workTitleId", workingEntity.WorkTitleId)); parameters.Add(new SqlParameter("@workerId", workingEntity.WorkerId)); parameters.Add(new SqlParameter("@workOpId", workingEntity.WorkOpId)); SQLServerHelper.Execute(query.ToString(), parameters.ToArray()); }
public void PaletteSave(PaletteEntity palette) { if (IsExistsPalette(palette)) { var parameters = new List <SqlParameter>(); var sql = @" update [KGWS].[dbo].[palettes] set [user_id]=@user_id ,[palette_name]=@palette_name ,[use_seg]=@use_seg ,[use_place]=@use_place ,[is_deleted]=@is_deleted where [palette_id]=@palette_id "; parameters.Clear(); parameters.Add(new SqlParameter("@palette_id", palette.PaletteId)); parameters.Add(new SqlParameter("@user_id", palette.UserId)); parameters.Add(new SqlParameter("@palette_name", palette.PaletteName)); parameters.Add(new SqlParameter("@use_seg", palette.UseSeg)); parameters.Add(new SqlParameter("@use_place", palette.UsePlace)); parameters.Add(new SqlParameter("@is_deleted", palette.IsDeleted)); SQLServerHelper.Execute(sql, parameters.ToArray()); } else { var parameters = new List <SqlParameter>(); var sql = @" insert into [KGWS].[dbo].[palettes] ( [user_id] ,[palette_name] ,[use_seg] ,[use_place] ,[is_deleted] ) values ( @user_id ,@palette_name ,@use_seg ,@use_place ,@is_deleted ) "; parameters.Clear(); parameters.Add(new SqlParameter("@user_id", palette.UserId)); parameters.Add(new SqlParameter("@palette_name", palette.PaletteName)); parameters.Add(new SqlParameter("@use_seg", palette.UseSeg)); parameters.Add(new SqlParameter("@use_place", palette.UsePlace)); parameters.Add(new SqlParameter("@is_deleted", palette.IsDeleted)); SQLServerHelper.Execute(sql, parameters.ToArray()); } }
public void ReStart() { StringBuilder query = new StringBuilder(); var parameters = new List <SqlParameter>(); query.AppendLine("update"); query.AppendLine(" [KGWS].[dbo].[Working]"); query.AppendLine("set [isDone]='false'"); parameters.Clear(); SQLServerHelper.Execute(query.ToString(), parameters.ToArray()); }
public void UpdateWorkingData(WorkingEntity workingEntity) { StringBuilder query = new StringBuilder(); var parameters = new List <SqlParameter>(); query.AppendLine("update"); query.AppendLine(" [KGWS].[dbo].[Working]"); query.AppendLine("set [isDone]='true'"); query.AppendLine("where"); query.AppendLine(" [id]=@id"); parameters.Clear(); parameters.Add(new SqlParameter("@id", workingEntity.Id)); SQLServerHelper.Execute(query.ToString(), parameters.ToArray()); }
public void ToNext(int workId, int workerId) { StringBuilder query = new StringBuilder(); var parameters = new List <SqlParameter>(); var id = GetWorkingId(workId, workerId); query.AppendLine("update"); query.AppendLine(" [KGWS].[dbo].[Working]"); query.AppendLine("set [isDone]='true'"); query.AppendLine("where"); query.AppendLine(" [id]=@id"); parameters.Clear(); parameters.Add(new SqlParameter("@id", id)); SQLServerHelper.Execute(query.ToString(), parameters.ToArray()); }
public void PaletteDetailsDelete(int paletteDetailsid) { var parameters = new List <SqlParameter>(); var sql = @" update [KGWS].[dbo].[palette_details] set [is_deleted]=@is_deleted where [palette_details_id]=@palette_details_id "; parameters.Clear(); parameters.Add(new SqlParameter("@palette_details_id", paletteDetailsid)); parameters.Add(new SqlParameter("@is_deleted", true)); SQLServerHelper.Execute(sql, parameters.ToArray()); }
public void PaletteDetailsSave(PaletteDetailsEntity paletteDetails) { var parameters = new List <SqlParameter>(); var sql = @" update [KGWS].[dbo].[palette_details] set [parts_quantity]=[parts_quantity]+@parts_quantity where [parts_name]=@parts_name and [parts_quantity]=@parts_quantity "; parameters.Clear(); parameters.Add(new SqlParameter("@parts_number", paletteDetails.PartsNumber)); parameters.Add(new SqlParameter("@parts_name", paletteDetails.PartsName)); parameters.Add(new SqlParameter("@parts_quantity", paletteDetails.PartsQuantity)); SQLServerHelper.Execute(sql, parameters.ToArray()); }
public void PaletteDetailsInsert(PaletteDetailsEntity paletteDetails) { var parameters = new List <SqlParameter>(); var sql = @" insert into [KGWS].[dbo].[palette_details] ( [palette_id] ,[assy_number] ,[parts_number] ,[parts_name] ,[parts_quantity] ,[place_key] ,[subAssembly_key] ,[is_deleted] ) values ( @palette_id ,@assy_number ,@parts_number ,@parts_name ,@parts_quantity ,@place_key ,@subAssembly_key ,@is_deleted ) "; parameters.Clear(); parameters.Add(new SqlParameter("@palette_id", paletteDetails.Paletteid)); parameters.Add(new SqlParameter("@assy_number", paletteDetails.AssyNumber)); parameters.Add(new SqlParameter("@parts_number", paletteDetails.PartsNumber)); parameters.Add(new SqlParameter("@parts_name", paletteDetails.PartsName)); parameters.Add(new SqlParameter("@parts_quantity", paletteDetails.PartsQuantity)); parameters.Add(new SqlParameter("@place_key", paletteDetails.PlaceKey)); parameters.Add(new SqlParameter("@subAssembly_key", paletteDetails.SubAssemblyKey)); parameters.Add(new SqlParameter("@is_deleted", paletteDetails.IsDeleted)); SQLServerHelper.Execute(sql, parameters.ToArray()); }
public void ActiityChangeSave(PerformanceEntity performance) { var parameters = new List <SqlParameter>(); var sql = @" insert into [KGWS].[dbo].[work_action] ( [block_name] ,[section_name] ,[activity_name] ,[user_id] ) values ( @block_name ,@section_name ,@activity_name ,@user_id ) select SCOPE_IDENTITY() as id "; parameters.Clear(); parameters.Add(new SqlParameter("@block_name", performance.WorkEntity.WorkBlockName)); parameters.Add(new SqlParameter("@section_name", performance.WorkEntity.WorkSectionName)); parameters.Add(new SqlParameter("@activity_name", performance.WorkEntity.WorkActivityName)); parameters.Add(new SqlParameter("@user_id", performance.User.UserId)); var id = 0; SQLServerHelper.Query( sql, parameters.ToArray(), reader => { id = Convert.ToInt32(reader["id"]); }); sql = @" insert into [KGWS].[dbo].[Time] ( [start_time] ,[end_time] ,[action_id] ,[milliseconds] ,[seconds] ,[minutes] ,[hours] ,[days] ,[total_milliseconds] ,[total_seconds] ,[total_minutes] ,[total_hours] ,[total_days] ) values ( @start_time ,@end_time ,@action_id ,@milliseconds ,@seconds ,@minutes ,@hours ,@days ,@total_milliseconds ,@total_seconds ,@total_minutes ,@total_hours ,@total_days ) "; parameters.Clear(); parameters.Add(new SqlParameter("@start_time", performance.StartTime)); parameters.Add(new SqlParameter("@end_time", performance.EndTime)); parameters.Add(new SqlParameter("@action_id", id)); parameters.Add(new SqlParameter("@milliseconds", performance.TimeSpanMs)); parameters.Add(new SqlParameter("@seconds", performance.TimeSpanS)); parameters.Add(new SqlParameter("@minutes", performance.TimeSpanM)); parameters.Add(new SqlParameter("@hours", performance.TimeSpanH)); parameters.Add(new SqlParameter("@days", performance.TimeSpanD)); parameters.Add(new SqlParameter("@total_milliseconds", performance.TotalTimeMs)); parameters.Add(new SqlParameter("@total_seconds", performance.TotalTimeS)); parameters.Add(new SqlParameter("@total_minutes", performance.TotalTimeM)); parameters.Add(new SqlParameter("@total_hours", performance.TotalTimeH)); parameters.Add(new SqlParameter("@total_days", performance.TotalTimeD)); SQLServerHelper.Execute(sql, parameters.ToArray()); }