public static EnumType.HandleResult AddPrintTemplate(SeatManage.ClassModel.AMS_PrintTemplateModel model) { IWCFService.ISeatManageService seatService = WcfAccessProxy.ServiceProxy.CreateChannelSeatManageService(); bool error = false; try { return(seatService.AddPrintTemplate(model)); } catch (Exception ex) { error = true; SeatManageComm.WriteLog.Write("添加打印模板失败:" + ex.Message); return(EnumType.HandleResult.Failed); } finally { ICommunicationObject ICommObjectService = seatService as ICommunicationObject; try { if (ICommObjectService.State == CommunicationState.Faulted) { ICommObjectService.Abort(); } else { ICommObjectService.Close(); } } catch { ICommObjectService.Abort(); } } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(SeatManage.ClassModel.AMS_PrintTemplateModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_SM_PrintTemplate("); strSql.Append("Template,UsedTimeStart,UsedTimeEnd,IsUsed,Describe,Num)"); strSql.Append(" values ("); strSql.Append("@Template,@UsedTimeStart,@UsedTimeEnd,@IsUsed,@Describe,@Num)"); SqlParameter[] parameters = { new SqlParameter("@Template", SqlDbType.Text), new SqlParameter("@UsedTimeStart", SqlDbType.DateTime), new SqlParameter("@UsedTimeEnd", SqlDbType.DateTime), new SqlParameter("@IsUsed", SqlDbType.Int, 4), new SqlParameter("@Describe", SqlDbType.NVarChar, 200), new SqlParameter("@Num", model.Num) }; parameters[0].Value = model.Template; parameters[1].Value = model.EffectDate; parameters[2].Value = model.EndDate; parameters[3].Value = 1; parameters[4].Value = model.Describe; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public static EnumType.HandleResult DeletePrintTemplate(SeatManage.ClassModel.AMS_PrintTemplateModel model) { IWCFService.ISeatManageService seatService = new WcfServiceForSeatManage.SeatManageDateService(); bool error = false; try { return(seatService.DeletePrintTemplate(model)); } catch (Exception ex) { error = true; SeatManageComm.WriteLog.Write("删除打印模板失败:" + ex.Message); return(EnumType.HandleResult.Failed); } }
/// <summary> /// 添加打印模板 /// </summary> /// <returns></returns> public HandleResult AddPrintTemplate(SeatManage.ClassModel.AMS_PrintTemplateModel model) { try { if (t_sm_PrintTemplate.Add(model)) { return(HandleResult.Successed); } else { return(HandleResult.Failed); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 删除打印模板 /// </summary> /// <param name="model"></param> /// <returns></returns> public SeatManage.EnumType.HandleResult DeletePrintTemplate(SeatManage.ClassModel.AMS_PrintTemplateModel model) { try { if (t_sm_PrintTemplate.Delete(model.Id.ToString())) { return(HandleResult.Successed); } else { return(HandleResult.Failed); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SeatManage.ClassModel.AMS_PrintTemplateModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_SM_PrintTemplate set "); strSql.Append("Template=@Template,"); strSql.Append("UsedTimeStart=@UsedTimeStart,"); strSql.Append("UsedTimeEnd=@UsedTimeEnd,"); strSql.Append("IsUsed=@IsUsed,"); strSql.Append("Describe=@Describe"); strSql.Append(" where Num=@Num "); SqlParameter[] parameters = { new SqlParameter("@Template", SqlDbType.Text), new SqlParameter("@UsedTimeStart", SqlDbType.DateTime), new SqlParameter("@UsedTimeEnd", SqlDbType.DateTime), new SqlParameter("@IsUsed", SqlDbType.Int, 4), new SqlParameter("@Describe", SqlDbType.NVarChar, 200), new SqlParameter("@Num", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.Template; parameters[1].Value = model.EffectDate; parameters[2].Value = model.EndDate; parameters[3].Value = 1; parameters[4].Value = model.Describe; parameters[5].Value = model.Num; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }