public List <PEIS.Model.OnFianlCheck> DataTableToList(DataTable dt) { List <PEIS.Model.OnFianlCheck> list = new List <PEIS.Model.OnFianlCheck>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { PEIS.Model.OnFianlCheck onFianlCheck = new PEIS.Model.OnFianlCheck(); if (dt.Rows[i]["ID_FinalCheck"].ToString() != "") { onFianlCheck.ID_FinalCheck = int.Parse(dt.Rows[i]["ID_FinalCheck"].ToString()); } if (dt.Rows[i]["ID_Customer"].ToString() != "") { onFianlCheck.ID_Customer = new long?(long.Parse(dt.Rows[i]["ID_Customer"].ToString())); } onFianlCheck.CustomerName = dt.Rows[i]["CustomerName"].ToString(); if (dt.Rows[i]["ID_FinalDoctor"].ToString() != "") { onFianlCheck.ID_FinalDoctor = new int?(int.Parse(dt.Rows[i]["ID_FinalDoctor"].ToString())); } onFianlCheck.FinalDoctor = dt.Rows[i]["FinalDoctor"].ToString(); if (dt.Rows[i]["SubmitDate"].ToString() != "") { onFianlCheck.SubmitDate = new DateTime?(DateTime.Parse(dt.Rows[i]["SubmitDate"].ToString())); } if (dt.Rows[i]["ID_FinalCheckDoctor"].ToString() != "") { onFianlCheck.ID_FinalCheckDoctor = new int?(int.Parse(dt.Rows[i]["ID_FinalCheckDoctor"].ToString())); } onFianlCheck.FinalCheckDoctor = dt.Rows[i]["FinalCheckDoctor"].ToString(); if (dt.Rows[i]["FinaleCheckDate"].ToString() != "") { onFianlCheck.FinaleCheckDate = new DateTime?(DateTime.Parse(dt.Rows[i]["FinaleCheckDate"].ToString())); } if (dt.Rows[i]["Is_Pass"].ToString() != "") { if (dt.Rows[i]["Is_Pass"].ToString() == "1" || dt.Rows[i]["Is_Pass"].ToString().ToLower() == "true") { onFianlCheck.Is_Pass = new bool?(true); } else { onFianlCheck.Is_Pass = new bool?(false); } } onFianlCheck.RefuseReason = dt.Rows[i]["RefuseReason"].ToString(); list.Add(onFianlCheck); } } return(list); }
public string GetCustomerRefuseReason(long ID_Customer) { PEIS.Model.OnFianlCheck customerLastOnFianlCheck = CommonConclusion.Instance.GetCustomerLastOnFianlCheck(ID_Customer); string result; if (customerLastOnFianlCheck != null) { if (customerLastOnFianlCheck.Is_Pass == false) { result = customerLastOnFianlCheck.RefuseReason; return(result); } } result = ""; return(result); }
public bool Update(PEIS.Model.OnFianlCheck model) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("update OnFianlCheck set "); stringBuilder.Append("ID_Customer=@ID_Customer,"); stringBuilder.Append("CustomerName=@CustomerName,"); stringBuilder.Append("ID_FinalDoctor=@ID_FinalDoctor,"); stringBuilder.Append("FinalDoctor=@FinalDoctor,"); stringBuilder.Append("SubmitDate=@SubmitDate,"); stringBuilder.Append("ID_FinalCheckDoctor=@ID_FinalCheckDoctor,"); stringBuilder.Append("FinalCheckDoctor=@FinalCheckDoctor,"); stringBuilder.Append("FinaleCheckDate=@FinaleCheckDate,"); stringBuilder.Append("Is_Pass=@Is_Pass,"); stringBuilder.Append("RefuseReason=@RefuseReason"); stringBuilder.Append(" where ID_FinalCheck=@ID_FinalCheck"); SqlParameter[] array = new SqlParameter[] { new SqlParameter("@ID_Customer", SqlDbType.BigInt, 8), new SqlParameter("@CustomerName", SqlDbType.VarChar, 30), new SqlParameter("@ID_FinalDoctor", SqlDbType.Int, 4), new SqlParameter("@FinalDoctor", SqlDbType.VarChar, 30), new SqlParameter("@SubmitDate", SqlDbType.DateTime), new SqlParameter("@ID_FinalCheckDoctor", SqlDbType.Int, 4), new SqlParameter("@FinalCheckDoctor", SqlDbType.VarChar, 30), new SqlParameter("@FinaleCheckDate", SqlDbType.DateTime), new SqlParameter("@Is_Pass", SqlDbType.Bit, 1), new SqlParameter("@RefuseReason", SqlDbType.Text), new SqlParameter("@ID_FinalCheck", SqlDbType.Int, 4) }; array[0].Value = model.ID_Customer; array[1].Value = model.CustomerName; array[2].Value = model.ID_FinalDoctor; array[3].Value = model.FinalDoctor; array[4].Value = model.SubmitDate; array[5].Value = model.ID_FinalCheckDoctor; array[6].Value = model.FinalCheckDoctor; array[7].Value = model.FinaleCheckDate; array[8].Value = model.Is_Pass; array[9].Value = model.RefuseReason; array[10].Value = model.ID_FinalCheck; int num = DbHelperSQL.ExecuteSql(stringBuilder.ToString(), array); return(num > 0); }
public int Add(PEIS.Model.OnFianlCheck model) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("insert into OnFianlCheck("); stringBuilder.Append("ID_Customer,CustomerName,ID_FinalDoctor,FinalDoctor,SubmitDate,ID_FinalCheckDoctor,FinalCheckDoctor,FinaleCheckDate,Is_Pass,RefuseReason)"); stringBuilder.Append(" values ("); stringBuilder.Append("@ID_Customer,@CustomerName,@ID_FinalDoctor,@FinalDoctor,@SubmitDate,@ID_FinalCheckDoctor,@FinalCheckDoctor,@FinaleCheckDate,@Is_Pass,@RefuseReason)"); stringBuilder.Append(";select @@IDENTITY"); SqlParameter[] array = new SqlParameter[] { new SqlParameter("@ID_Customer", SqlDbType.BigInt, 8), new SqlParameter("@CustomerName", SqlDbType.VarChar, 30), new SqlParameter("@ID_FinalDoctor", SqlDbType.Int, 4), new SqlParameter("@FinalDoctor", SqlDbType.VarChar, 30), new SqlParameter("@SubmitDate", SqlDbType.DateTime), new SqlParameter("@ID_FinalCheckDoctor", SqlDbType.Int, 4), new SqlParameter("@FinalCheckDoctor", SqlDbType.VarChar, 30), new SqlParameter("@FinaleCheckDate", SqlDbType.DateTime), new SqlParameter("@Is_Pass", SqlDbType.Bit, 1), new SqlParameter("@RefuseReason", SqlDbType.Text) }; array[0].Value = model.ID_Customer; array[1].Value = model.CustomerName; array[2].Value = model.ID_FinalDoctor; array[3].Value = model.FinalDoctor; array[4].Value = model.SubmitDate; array[5].Value = model.ID_FinalCheckDoctor; array[6].Value = model.FinalCheckDoctor; array[7].Value = model.FinaleCheckDate; array[8].Value = model.Is_Pass; array[9].Value = model.RefuseReason; object single = DbHelperSQL.GetSingle(stringBuilder.ToString(), array); int result; if (single == null) { result = 0; } else { result = Convert.ToInt32(single); } return(result); }
public bool Update(PEIS.Model.OnFianlCheck model) { return(this.dal.Update(model)); }
public int Add(PEIS.Model.OnFianlCheck model) { return(this.dal.Add(model)); }
public int SaveCustomerFinaUnCheck(PEIS.Model.OnFianlCheck OFCModel) { return(CommonConclusion.dal.SaveCustomerFinaUnCheck(OFCModel)); }
public PEIS.Model.OnFianlCheck GetModel(int ID_FinalCheck) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("select top 1 ID_FinalCheck,ID_Customer,CustomerName,ID_FinalDoctor,FinalDoctor,SubmitDate,ID_FinalCheckDoctor,FinalCheckDoctor,FinaleCheckDate,Is_Pass,RefuseReason from OnFianlCheck "); stringBuilder.Append(" where ID_FinalCheck=@ID_FinalCheck"); SqlParameter[] array = new SqlParameter[] { new SqlParameter("@ID_FinalCheck", SqlDbType.Int, 4) }; array[0].Value = ID_FinalCheck; PEIS.Model.OnFianlCheck onFianlCheck = new PEIS.Model.OnFianlCheck(); DataSet dataSet = DbHelperSQL.Query(stringBuilder.ToString(), array); PEIS.Model.OnFianlCheck result; if (dataSet.Tables[0].Rows.Count > 0) { if (dataSet.Tables[0].Rows[0]["ID_FinalCheck"].ToString() != "") { onFianlCheck.ID_FinalCheck = int.Parse(dataSet.Tables[0].Rows[0]["ID_FinalCheck"].ToString()); } if (dataSet.Tables[0].Rows[0]["ID_Customer"].ToString() != "") { onFianlCheck.ID_Customer = new long?(long.Parse(dataSet.Tables[0].Rows[0]["ID_Customer"].ToString())); } onFianlCheck.CustomerName = dataSet.Tables[0].Rows[0]["CustomerName"].ToString(); if (dataSet.Tables[0].Rows[0]["ID_FinalDoctor"].ToString() != "") { onFianlCheck.ID_FinalDoctor = new int?(int.Parse(dataSet.Tables[0].Rows[0]["ID_FinalDoctor"].ToString())); } onFianlCheck.FinalDoctor = dataSet.Tables[0].Rows[0]["FinalDoctor"].ToString(); if (dataSet.Tables[0].Rows[0]["SubmitDate"].ToString() != "") { onFianlCheck.SubmitDate = new DateTime?(DateTime.Parse(dataSet.Tables[0].Rows[0]["SubmitDate"].ToString())); } if (dataSet.Tables[0].Rows[0]["ID_FinalCheckDoctor"].ToString() != "") { onFianlCheck.ID_FinalCheckDoctor = new int?(int.Parse(dataSet.Tables[0].Rows[0]["ID_FinalCheckDoctor"].ToString())); } onFianlCheck.FinalCheckDoctor = dataSet.Tables[0].Rows[0]["FinalCheckDoctor"].ToString(); if (dataSet.Tables[0].Rows[0]["FinaleCheckDate"].ToString() != "") { onFianlCheck.FinaleCheckDate = new DateTime?(DateTime.Parse(dataSet.Tables[0].Rows[0]["FinaleCheckDate"].ToString())); } if (dataSet.Tables[0].Rows[0]["Is_Pass"].ToString() != "") { if (dataSet.Tables[0].Rows[0]["Is_Pass"].ToString() == "1" || dataSet.Tables[0].Rows[0]["Is_Pass"].ToString().ToLower() == "true") { onFianlCheck.Is_Pass = new bool?(true); } else { onFianlCheck.Is_Pass = new bool?(false); } } onFianlCheck.RefuseReason = dataSet.Tables[0].Rows[0]["RefuseReason"].ToString(); result = onFianlCheck; } else { result = null; } return(result); }