public ActionResult InsertIE(IECONFIGInfor infor) { string SQLstring = ""; try { if (ExistsIEOnInsert(infor)) { return ActionResult.ExistedRecord; } if (!isUseNewAPI()) { SQLstring = "INSERT INTO TBL_IECONFIG (IE_NAME, START_WIDTH ,START_CENTER,END_WIDTH,END_CENTER"; SQLstring += ",APPLY_GAMMA ,APPLY_CONTRAST,APPLY_BRIGHTNESS,APPLY_MSE,GAMMA_VALUE,CONTRAST_VALUE"; SQLstring += ",BRIGHTNESS_VALUE,MSE_VALUE,MSE_APPLY_ELGE_EHANCEMENT,MSE_APPLY_LATITUDE_REDUCTION"; SQLstring += ",MSE_EC,MSE_EL,MSE_LC,MSE_LL,MSE_TYPE ,MSE_ORDER,CONTRAST_ORDER,BRIGHTNESS_ORDER,GAMMA_ORDER,WOB,INVERT_STT,INVERT_AFTER,APPLY_INVERT,APPLY_WL,WL_WIDTH,WL_CENTER,WL_STT,WL_WOB,LOW,HIGH,WL_LOW,WL_HIGH,APPLY_INVERT_FIRST,AUTO_MIN_MAX_BIT,APPLY_HEC,HEC_STT,APPLY_MED,MED_STT,MED_VALUE,IS_ENABLE,APPLY_MOTIONBLUR,MB_DIMENSION,MB_ANGLE,MB_STT,APPLY_ANTIALIAS,ANTIALIAS_DIMENSION,ANTIALIAS_THRESHOLD,ANTIALIAS_FILTER,ANTIALIAS_STT,APPLY_SE,SE_STT)"; SQLstring += " VALUES('" + infor.IE_NAME + "'," + infor.START_WIDTH + "," + infor.START_CENTER + "," + infor.END_WIDTH + "," + infor.END_CENTER + "," + infor.APPLY_GAMMA + ","; SQLstring += infor.APPLY_CONTRAST + "," + infor.APPLY_BRIGHTNESS + "," + infor.APPLY_MSE + "," + infor.GAMMA_VALUE + "," + infor.CONTRAST_VALUE + "," + infor.BRIGHTNESS_VALUE + ","; SQLstring += infor.MSE_VALUE + "," + infor.MSE_APPLY_ELGE_EHANCEMENT + "," + infor.MSE_APPLY_LATITUDE_REDUCTION + "," + infor.MSE_EC + "," + infor.MSE_EL + ","; SQLstring += infor.MSE_LC + "," + infor.MSE_LL + "," + infor.MSE_TYPE + "," + infor.MSE_ORDER + "," + infor.CONTRAST_ORDER + "," + infor.BRIGHTNESS_ORDER + ","; SQLstring += infor.GAMMA_ORDER + "," + infor.WOB + "," + infor.INVERT_STT + "," + infor.INVERT_AFTER + "," + infor.APPLY_INVERT + "," + infor.APPLY_WL + "," + infor.WL_WIDTH + "," + infor.WL_CENTER + "," + infor.WL_STT + "," + infor.WL_WOB + ","; SQLstring += infor.LOW + "," + infor.HIGH + "," + infor.WL_LOW + "," + infor.WL_HIGH + "," + infor.APPLY_INVERT_FIRST + "," + infor.AUTO_MIN_MAX_BIT + "," + infor.APPLY_HEC + "," + infor.HEC_STT + "," + infor.APPLY_MED + "," + infor.MED_STT + "," + infor.MED_VALUE + "," + infor.IS_ENABLE + "," + infor.APPLY_MOTIONBLUR + "," + infor.MB_DIMENSION + "," + infor.MB_ANGLE + "," + infor.MB_STT + "," + infor.APPLY_ANTIALIAS + "," + infor.ANTIALIAS_DIMENSION + "," + infor.ANTIALIAS_THRESHOLD + "," + infor.ANTIALIAS_FILTER + "," + infor.ANTIALIAS_STT + "," + infor.APPLY_SE + "," + infor.SE_STT + ")"; } else { SQLstring = "INSERT INTO TBL_IECONFIG (IE_NAME, START_WIDTH ,START_CENTER,END_WIDTH,END_CENTER"; SQLstring += ",APPLY_GAMMA ,APPLY_CONTRAST,APPLY_BRIGHTNESS,APPLY_MSE,GAMMA_VALUE,CONTRAST_VALUE"; SQLstring += ",BRIGHTNESS_VALUE,MSE_VALUE,MSE_APPLY_ELGE_EHANCEMENT,MSE_APPLY_LATITUDE_REDUCTION"; SQLstring += ",MSE_EC,MSE_EL,MSE_LC,MSE_LL,MSE_TYPE ,MSE_ORDER,CONTRAST_ORDER,BRIGHTNESS_ORDER,GAMMA_ORDER,WOB,INVERT_STT,INVERT_AFTER,APPLY_INVERT,APPLY_WL,WL_WIDTH,WL_CENTER,WL_STT,WL_WOB,LOW,HIGH,WL_LOW,WL_HIGH,APPLY_INVERT_FIRST,AUTO_MIN_MAX_BIT,APPLY_HEC,HEC_STT,APPLY_MED,MED_STT,MED_VALUE,IS_ENABLE,APPLY_MOTIONBLUR,MB_DIMENSION,MB_ANGLE,MB_STT,APPLY_ANTIALIAS,ANTIALIAS_DIMENSION,ANTIALIAS_THRESHOLD,ANTIALIAS_FILTER,ANTIALIAS_STT,APPLY_SE,SE_STT,XRES,YRES,NBINS,LLV,HLV,SLOPE,NEWAPI,LUTTYPE)"; SQLstring += " VALUES('" + infor.IE_NAME + "'," + infor.START_WIDTH + "," + infor.START_CENTER + "," + infor.END_WIDTH + "," + infor.END_CENTER + "," + infor.APPLY_GAMMA + ","; SQLstring += infor.APPLY_CONTRAST + "," + infor.APPLY_BRIGHTNESS + "," + infor.APPLY_MSE + "," + infor.GAMMA_VALUE + "," + infor.CONTRAST_VALUE + "," + infor.BRIGHTNESS_VALUE + ","; SQLstring += infor.MSE_VALUE + "," + infor.MSE_APPLY_ELGE_EHANCEMENT + "," + infor.MSE_APPLY_LATITUDE_REDUCTION + "," + infor.MSE_EC + "," + infor.MSE_EL + ","; SQLstring += infor.MSE_LC + "," + infor.MSE_LL + "," + infor.MSE_TYPE + "," + infor.MSE_ORDER + "," + infor.CONTRAST_ORDER + "," + infor.BRIGHTNESS_ORDER + ","; SQLstring += infor.GAMMA_ORDER + "," + infor.WOB + "," + infor.INVERT_STT + "," + infor.INVERT_AFTER + "," + infor.APPLY_INVERT + "," + infor.APPLY_WL + "," + infor.WL_WIDTH + "," + infor.WL_CENTER + "," + infor.WL_STT + "," + infor.WL_WOB + ","; SQLstring += infor.LOW + "," + infor.HIGH + "," + infor.WL_LOW + "," + infor.WL_HIGH + "," + infor.APPLY_INVERT_FIRST + "," + infor.AUTO_MIN_MAX_BIT + "," + infor.APPLY_HEC + "," + infor.HEC_STT + "," + infor.APPLY_MED + "," + infor.MED_STT + "," + infor.MED_VALUE + "," + infor.IS_ENABLE + "," + infor.APPLY_MOTIONBLUR + "," + infor.MB_DIMENSION + "," + infor.MB_ANGLE + "," + infor.MB_STT + "," + infor.APPLY_ANTIALIAS + "," + infor.ANTIALIAS_DIMENSION + "," + infor.ANTIALIAS_THRESHOLD + "," + infor.ANTIALIAS_FILTER + "," + infor.ANTIALIAS_STT + "," + infor.APPLY_SE + "," + infor.SE_STT + "," + infor.XRES + "," + infor.YRES + "," + infor.NBINS + "," + infor.LLV + "," + infor.HLV + "," + infor.SLOPE + ",1," + infor.LUTTYPE + ")"; } if (DataAccess.ExecuteNonQuery(globalVariables.OleDbConnection, CommandType.Text, SQLstring) > 0) { infor.ID = Convert.ToInt16(Utility.getCurrentMaxID("ID", "TBL_IECONFIG")); return ActionResult.Success; } else { return ActionResult.Error; } } catch (Exception ex) { Utility.ShowMsg(ex.Message); return ActionResult.Exception; } }
private bool ExistsIEOnInsert(IECONFIGInfor _infor) { DataSet ds = null; try { ds = DataAccess.ExecuteDataset(globalVariables.OleDbConnection, CommandType.Text, "SELECT * FROM TBL_IECONFIG WHERE IE_NAME='" + _infor .IE_NAME+ "'"); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { return true; } else { return false; } } catch (Exception ex) { return false; } }
/// <summary> /// Trả về đối tượng Infor dựa vào Primary key của nó /// </summary> /// <param name="ID"></param> /// <returns></returns> public static IECONFIGInfor GetIEInfor(int ID) { DataSet ds = new ModalityController().GetIEData("ID=" + ID.ToString()); IECONFIGInfor _infor = new IECONFIGInfor(); if (ds != null) { if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; _infor.ID = -1; _infor.IE_NAME = Utility.sDbnull(dr["IE_NAME"]); _infor.GAMMA_VALUE = Utility.Int32Dbnull(dr["GAMMA_VALUE"]); _infor.CONTRAST_VALUE = Utility.Int32Dbnull(dr["CONTRAST_VALUE"]); _infor.BRIGHTNESS_VALUE = Utility.Int32Dbnull(dr["BRIGHTNESS_VALUE"]); _infor.MSE_VALUE = Utility.Int32Dbnull(dr["MSE_VALUE"]); _infor.MSE_EC = Utility.Int32Dbnull(dr["MSE_EC"]); _infor.MSE_EL = Utility.Int32Dbnull(dr["MSE_EL"]); _infor.MSE_LC = Utility.Int32Dbnull(dr["MSE_LC"]); _infor.MSE_LL = Utility.Int32Dbnull(dr["MSE_LL"]); _infor.MSE_TYPE = Utility.Int32Dbnull(dr["MSE_TYPE"]); _infor.MSE_ORDER = Utility.Int32Dbnull(dr["MSE_ORDER"]); _infor.CONTRAST_ORDER = Utility.Int32Dbnull(dr["CONTRAST_ORDER"]); _infor.BRIGHTNESS_ORDER = Utility.Int32Dbnull(dr["BRIGHTNESS_ORDER"]); _infor.GAMMA_ORDER = Utility.Int32Dbnull(dr["GAMMA_ORDER"]); _infor.WOB = Utility.Int32Dbnull(dr["WOB"]); _infor.LOW = Utility.Int32Dbnull(dr["LOW"]); _infor.HIGH = Utility.Int32Dbnull(dr["HIGH"]); _infor.WL_HIGH = Utility.Int32Dbnull(dr["WL_HIGH"]); _infor.WL_LOW = Utility.Int32Dbnull(dr["WL_LOW"]); _infor.MSE_APPLY_ELGE_EHANCEMENT = Utility.Int32Dbnull(dr["MSE_APPLY_ELGE_EHANCEMENT"]); _infor.MSE_APPLY_LATITUDE_REDUCTION = Utility.Int32Dbnull(dr["MSE_APPLY_LATITUDE_REDUCTION"]); _infor.START_WIDTH = Utility.Int32Dbnull(dr["START_WIDTH"]); _infor.START_CENTER = Utility.Int32Dbnull(dr["START_CENTER"]); _infor.END_WIDTH = Utility.Int32Dbnull(dr["END_WIDTH"]); _infor.END_CENTER = Utility.Int32Dbnull(dr["END_CENTER"]); _infor.APPLY_GAMMA = Utility.Int32Dbnull(dr["APPLY_GAMMA"]); _infor.APPLY_CONTRAST = Utility.Int32Dbnull(dr["APPLY_CONTRAST"]); _infor.APPLY_BRIGHTNESS = Utility.Int32Dbnull(dr["APPLY_BRIGHTNESS"]); _infor.APPLY_MSE = Utility.Int32Dbnull(dr["APPLY_MSE"]); _infor.INVERT_STT = Utility.Int32Dbnull(dr["INVERT_STT"]); _infor.INVERT_AFTER = Utility.Int32Dbnull(dr["INVERT_AFTER"]); _infor.APPLY_INVERT = Utility.Int32Dbnull(dr["APPLY_INVERT"]); _infor.WL_CENTER = Utility.Int32Dbnull(dr["WL_CENTER"]); _infor.WL_STT = Utility.Int32Dbnull(dr["WL_STT"]); _infor.WL_WIDTH = Utility.Int32Dbnull(dr["WL_WIDTH"]); _infor.APPLY_WL = Utility.Int32Dbnull(dr["APPLY_WL"]); _infor.WL_WOB = Utility.Int32Dbnull(dr["WL_WOB"]); _infor.APPLY_HEC = Utility.Int32Dbnull(dr["APPLY_HEC"]); _infor.HEC_STT = Utility.Int32Dbnull(dr["HEC_STT"]); _infor.APPLY_SE = Utility.Int32Dbnull(dr["APPLY_SE"]); _infor.SE_STT = Utility.Int32Dbnull(dr["SE_STT"]); return _infor; } else { return null; } } else { return null; } }
public ActionResult UpdateIE(IECONFIGInfor infor) { string SQLstring = ""; try { if (ExistsIEOnUpdate(infor)) { return ActionResult.ExistedRecord; } if (!isUseNewAPI()) { SQLstring = "Update TBL_IECONFIG set IE_NAME='" + infor.IE_NAME + "', START_WIDTH=" + infor.START_WIDTH + " ,START_CENTER=" + infor.START_CENTER + " ,END_WIDTH=" + infor.END_WIDTH + " ,END_CENTER=" + infor.END_CENTER + " "; SQLstring += ",APPLY_GAMMA=" + infor.APPLY_GAMMA + " ,APPLY_CONTRAST=" + infor.APPLY_CONTRAST + " ,APPLY_BRIGHTNESS=" + infor.APPLY_BRIGHTNESS + " ,APPLY_MSE=" + infor.APPLY_MSE + " ,GAMMA_VALUE=" + infor.GAMMA_VALUE + " ,CONTRAST_VALUE=" + infor.CONTRAST_VALUE + " "; SQLstring += ",BRIGHTNESS_VALUE=" + infor.BRIGHTNESS_VALUE + " ,MSE_VALUE=" + infor.MSE_VALUE + " ,MSE_APPLY_ELGE_EHANCEMENT=" + infor.MSE_APPLY_ELGE_EHANCEMENT + " ,MSE_APPLY_LATITUDE_REDUCTION=" + infor.MSE_APPLY_LATITUDE_REDUCTION + " "; SQLstring += ",MSE_EC=" + infor.MSE_EC + " ,MSE_EL=" + infor.MSE_EL + " ,MSE_LC=" + infor.MSE_LC + " ,MSE_LL=" + infor.MSE_LL + " ,MSE_TYPE=" + infor.MSE_TYPE + " ,MSE_ORDER=" + infor.MSE_ORDER + " ,CONTRAST_ORDER=" + infor.CONTRAST_ORDER + " ,BRIGHTNESS_ORDER=" + infor.BRIGHTNESS_ORDER + " ,GAMMA_ORDER=" + infor.GAMMA_ORDER + " ,WOB=" + infor.WOB + ",INVERT_STT= " + infor.INVERT_STT + ",INVERT_AFTER= " + infor.INVERT_AFTER + ",APPLY_INVERT= " + infor.APPLY_INVERT + " "; SQLstring += ",APPLY_WL=" + infor.APPLY_WL + " ,WL_WIDTH=" + infor.WL_WIDTH + " ,WL_CENTER=" + infor.WL_CENTER + " ,WL_STT=" + infor.WL_STT + " ,WL_WOB=" + infor.WL_WOB + " "; SQLstring += ",LOW=" + infor.LOW + " ,HIGH=" + infor.HIGH + " ,WL_LOW=" + infor.WL_LOW + " ,WL_HIGH=" + infor.WL_HIGH + " "; SQLstring += ",APPLY_INVERT_FIRST=" + infor.APPLY_INVERT_FIRST + " ,AUTO_MIN_MAX_BIT=" + infor.AUTO_MIN_MAX_BIT + " ,APPLY_HEC=" + infor.APPLY_HEC + " ,HEC_STT=" + infor.HEC_STT + " "; SQLstring += ",APPLY_MED=" + infor.APPLY_MED + " ,MED_VALUE=" + infor.MED_VALUE + " ,MED_STT=" + infor.MED_STT + " "; SQLstring += ",APPLY_MOTIONBLUR=" + infor.APPLY_MOTIONBLUR + " ,MB_DIMENSION=" + infor.MB_DIMENSION + " ,MB_ANGLE=" + infor.MB_ANGLE + " ,MB_STT=" + infor.MB_STT + " "; SQLstring += ",APPLY_ANTIALIAS=" + infor.APPLY_ANTIALIAS + " ,ANTIALIAS_DIMENSION=" + infor.ANTIALIAS_DIMENSION + " ,ANTIALIAS_THRESHOLD=" + infor.ANTIALIAS_THRESHOLD + " ,ANTIALIAS_FILTER=" + infor.ANTIALIAS_FILTER + " ,ANTIALIAS_STT=" + infor.ANTIALIAS_STT + ",APPLY_SE=" + infor.APPLY_SE + ",SE_STT=" + infor.SE_STT + " "; SQLstring += " WHERE ID=" + infor.ID; } else { SQLstring = "Update TBL_IECONFIG set IE_NAME='" + infor.IE_NAME + "', START_WIDTH=" + infor.START_WIDTH + " ,START_CENTER=" + infor.START_CENTER + " ,END_WIDTH=" + infor.END_WIDTH + " ,END_CENTER=" + infor.END_CENTER + " "; SQLstring += ",APPLY_GAMMA=" + infor.APPLY_GAMMA + " ,APPLY_CONTRAST=" + infor.APPLY_CONTRAST + " ,APPLY_BRIGHTNESS=" + infor.APPLY_BRIGHTNESS + " ,APPLY_MSE=" + infor.APPLY_MSE + " ,GAMMA_VALUE=" + infor.GAMMA_VALUE + " ,CONTRAST_VALUE=" + infor.CONTRAST_VALUE + " "; SQLstring += ",BRIGHTNESS_VALUE=" + infor.BRIGHTNESS_VALUE + " ,MSE_VALUE=" + infor.MSE_VALUE + " ,MSE_APPLY_ELGE_EHANCEMENT=" + infor.MSE_APPLY_ELGE_EHANCEMENT + " ,MSE_APPLY_LATITUDE_REDUCTION=" + infor.MSE_APPLY_LATITUDE_REDUCTION + " "; SQLstring += ",MSE_EC=" + infor.MSE_EC + " ,MSE_EL=" + infor.MSE_EL + " ,MSE_LC=" + infor.MSE_LC + " ,MSE_LL=" + infor.MSE_LL + " ,MSE_TYPE=" + infor.MSE_TYPE + " ,MSE_ORDER=" + infor.MSE_ORDER + " ,CONTRAST_ORDER=" + infor.CONTRAST_ORDER + " ,BRIGHTNESS_ORDER=" + infor.BRIGHTNESS_ORDER + " ,GAMMA_ORDER=" + infor.GAMMA_ORDER + " ,WOB=" + infor.WOB + ",INVERT_STT= " + infor.INVERT_STT + ",INVERT_AFTER= " + infor.INVERT_AFTER + ",APPLY_INVERT= " + infor.APPLY_INVERT + " "; SQLstring += ",APPLY_WL=" + infor.APPLY_WL + " ,WL_WIDTH=" + infor.WL_WIDTH + " ,WL_CENTER=" + infor.WL_CENTER + " ,WL_STT=" + infor.WL_STT + " ,WL_WOB=" + infor.WL_WOB + " "; SQLstring += ",LOW=" + infor.LOW + " ,HIGH=" + infor.HIGH + " ,WL_LOW=" + infor.WL_LOW + " ,WL_HIGH=" + infor.WL_HIGH + " "; SQLstring += ",APPLY_INVERT_FIRST=" + infor.APPLY_INVERT_FIRST + " ,AUTO_MIN_MAX_BIT=" + infor.AUTO_MIN_MAX_BIT + " ,APPLY_HEC=" + infor.APPLY_HEC + " ,HEC_STT=" + infor.HEC_STT + " "; SQLstring += ",APPLY_MED=" + infor.APPLY_MED + " ,MED_VALUE=" + infor.MED_VALUE + " ,MED_STT=" + infor.MED_STT + " "; SQLstring += ",APPLY_MOTIONBLUR=" + infor.APPLY_MOTIONBLUR + " ,MB_DIMENSION=" + infor.MB_DIMENSION + " ,MB_ANGLE=" + infor.MB_ANGLE + " ,MB_STT=" + infor.MB_STT + " "; SQLstring += ",APPLY_ANTIALIAS=" + infor.APPLY_ANTIALIAS + " ,ANTIALIAS_DIMENSION=" + infor.ANTIALIAS_DIMENSION + " ,ANTIALIAS_THRESHOLD=" + infor.ANTIALIAS_THRESHOLD + " ,ANTIALIAS_FILTER=" + infor.ANTIALIAS_FILTER + " ,ANTIALIAS_STT=" + infor.ANTIALIAS_STT + ",APPLY_SE=" + infor.APPLY_SE + ",SE_STT=" + infor.SE_STT + " "; SQLstring += ",XRES=" + infor.XRES + " ,YRES=" + infor.YRES + " ,NBINS=" + infor.NBINS + " ,LLV=" + infor.LLV + " ,HLV=" + infor.HLV + ",SLOPE=" + infor.SLOPE + ",LUTTYPE=" + infor.LUTTYPE + ",NEWAPI= "+infor.NEWAPI+" "; SQLstring += " WHERE ID=" + infor.ID; } if (DataAccess.ExecuteNonQuery(globalVariables.OleDbConnection, CommandType.Text, SQLstring) > 0) { return ActionResult.Success; } else { return ActionResult.Error; } } catch (Exception ex) { Utility.ShowMsg(ex.Message); return ActionResult.Exception; } }