/// <summary> /// 空閒狀態主檔 /// </summary> public List<IdleState_ism_Info> GetIdleStateMaster() { try { List<IdleState_ism_Info> list = new List<IdleState_ism_Info>(); StringBuilder strSql = new StringBuilder(); strSql.AppendLine("select"); strSql.AppendLine("ism_RecordID,ism_cStateName,ism_nDescription,ism_lIsBuildin,ism_lIsAtive,ism_cAdd,ism_dAddDate,ism_cLast,ism_dLastDate "); strSql.AppendLine("from IdleStateMaster_ism "); strSql.AppendLine("where ism_lIsAtive=1 "); using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (sdr.Read()) { IdleState_ism_Info model = new IdleState_ism_Info(); if (sdr["ism_RecordID"] != null && sdr["ism_RecordID"].ToString() != "") { model.ism_RecordID = new Guid(sdr["ism_RecordID"].ToString()); } if (sdr["ism_cStateName"] != null && sdr["ism_cStateName"].ToString() != "") { model.ism_cStateName = sdr["ism_cStateName"].ToString(); } if (sdr["ism_nDescription"] != null && sdr["ism_nDescription"].ToString() != "") { model.ism_nDescription = sdr["ism_nDescription"].ToString(); } if (sdr["ism_lIsBuildin"] != null && sdr["ism_lIsBuildin"].ToString() != "") { if ((sdr["ism_lIsBuildin"].ToString() == "1") || (sdr["ism_lIsBuildin"].ToString().ToLower() == "true")) { model.ism_lIsBuildin = true; } else { model.ism_lIsBuildin = false; } } if (sdr["ism_lIsAtive"] != null && sdr["ism_lIsAtive"].ToString() != "") { if ((sdr["ism_lIsAtive"].ToString() == "1") || (sdr["ism_lIsAtive"].ToString().ToLower() == "true")) { model.ism_lIsAtive = true; } else { model.ism_lIsAtive = false; } } if (sdr["ism_cAdd"] != null && sdr["ism_cAdd"].ToString() != "") { model.ism_cAdd = sdr["ism_cAdd"].ToString(); } if (sdr["ism_dAddDate"] != null && sdr["ism_dAddDate"].ToString() != "") { model.ism_dAddDate = DateTime.Parse(sdr["ism_dAddDate"].ToString()); } if (sdr["ism_cLast"] != null && sdr["ism_cLast"].ToString() != "") { model.ism_cLast = sdr["ism_cLast"].ToString(); } if (sdr["ism_dLastDate"] != null && sdr["ism_dLastDate"].ToString() != "") { model.ism_dLastDate = DateTime.Parse(sdr["ism_dLastDate"].ToString()); } list.Add(model); } } return list; } catch (Exception ex) { throw ex; } }
public IList<IdleState_ism_Info> GetPrepareItems(int PageSize, int PageIndex, string OrderBy, IdleState_ism_Info cond) { throw new NotImplementedException(); }
private string GetIdleStateMasterSQL(IdleState_ism_Info model) { StringBuilder strSql = new StringBuilder(); StringBuilder strSql1 = new StringBuilder(); StringBuilder strSql2 = new StringBuilder(); if (model.ism_RecordID != null) { strSql1.Append("ism_RecordID,"); strSql2.Append("'" + model.ism_RecordID + "',"); } if (model.ism_cStateName != null) { strSql1.Append("ism_cStateName,"); strSql2.Append("'" + model.ism_cStateName + "',"); } if (model.ism_nDescription != null) { strSql1.Append("ism_nDescription,"); strSql2.Append("'" + model.ism_nDescription + "',"); } if (model.ism_lIsBuildin != null) { strSql1.Append("ism_lIsBuildin,"); strSql2.Append("" + (model.ism_lIsBuildin ? 1 : 0) + ","); } if (model.ism_lIsAtive != null) { strSql1.Append("ism_lIsAtive,"); strSql2.Append("" + (model.ism_lIsAtive ? 1 : 0) + ","); } if (model.ism_cAdd != null) { strSql1.Append("ism_cAdd,"); strSql2.Append("'" + model.ism_cAdd + "',"); } if (model.ism_dAddDate != null) { strSql1.Append("ism_dAddDate,"); strSql2.Append("'" + model.ism_dAddDate.Value.ToString(this._sqlLiteDatetimeFormat) + "',"); } if (model.ism_cLast != null) { strSql1.Append("ism_cLast,"); strSql2.Append("'" + model.ism_cLast + "',"); } else { strSql1.Append("ism_cLast,"); strSql2.Append("'',"); } if (model.ism_dLastDate != null) { strSql1.Append("ism_dLastDate,"); strSql2.Append("'" + model.ism_dLastDate.Value.ToString(this._sqlLiteDatetimeFormat) + "',"); } strSql.Append("insert into IdleStateMaster_ism("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); return strSql.ToString(); }