0% found this document useful (0 votes)
47 views

MVVM

The document contains code for retrieving and updating price master and order balance data from a database in C#. It includes functions for checking price data for a product, retrieving current and previous price values, and getting order balance amounts by product and customer area. The code opens a database connection, executes SQL queries parameterized by product info, and returns or updates the reference parameters with the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

MVVM

The document contains code for retrieving and updating price master and order balance data from a database in C#. It includes functions for checking price data for a product, retrieving current and previous price values, and getting order balance amounts by product and customer area. The code opens a database connection, executes SQL queries parameterized by product info, and returns or updates the reference parameters with the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

//4,単価マスタ

public static int HF_VH_M_TANKA_CHK(string SHOHIN_NO, ref string


KAITEI_YMD, ref long L_TAN,
ref long D_TAN, ref long NAI_FHI_TAN, ref long GAI_FHI_TAN, ref long
SAA_TAN, ref string KAI_RIYU_CD,
ref long OLD_L_TAN, ref long OLD_D_TAN, ref long OLD_NAI_FHI_TAN, ref
long OLD_GAI_FHI_TAN,
ref long OLD_SAA_TAN, bool MSG_FLG)
{
int result = -1;
DatabaseService ds = new DatabaseService();
try
{
SQLMapHelper.StartTransaction();
Dictionary<string, string> reqParamQuery = new Dictionary<string,
string>();
reqParamQuery.Add("prmSHOHIN_NO", SHOHIN_NO);
reqParamQuery.Add("prmKAITEI_YMD", KAITEI_YMD);
DatabaseServiceResult dbr =
ds.SelectRequestCom(@"VH_M_TANKA.selectBySHOHIN_NOAndKAITEI_YMD", reqParamQuery);

SQLMapHelper.CommitTransaction();

if (dbr.ResultArray.First().Count < 1)
{
if (MSG_FLG)
HF_MSG("EX21", 0, "");

result = 1;
}
else
{
DataTable gettbdata = dbr.ResultArray[0].Data.ToDataTable();
KAITEI_YMD = gettbdata.Rows[0]["KAITEI_YMD"].ToString();
Int64.TryParse(gettbdata.Rows[0]["L_TAN"].ToString(), out
L_TAN);
Int64.TryParse(gettbdata.Rows[0]["D_TAN"].ToString(), out
D_TAN);
Int64.TryParse(gettbdata.Rows[0]["NAI_FHI_TAN"].ToString(),
out NAI_FHI_TAN);
Int64.TryParse(gettbdata.Rows[0]["GAI_FHI_TAN"].ToString(),
out GAI_FHI_TAN);
Int64.TryParse(gettbdata.Rows[0]["SAA_TAN"].ToString(), out
SAA_TAN);
KAI_RIYU_CD = gettbdata.Rows[0]["KAI_RIYU_CD"].ToString();
if (gettbdata.Rows.Count > 1)
{
Int64.TryParse(gettbdata.Rows[1]["L_TAN"].ToString(), out
OLD_L_TAN);
Int64.TryParse(gettbdata.Rows[1]["L_TAN"].ToString(), out
OLD_D_TAN);

Int64.TryParse(gettbdata.Rows[1]["NAI_FHI_TAN"].ToString(), out OLD_NAI_FHI_TAN);

Int64.TryParse(gettbdata.Rows[1]["GAI_FHI_TAN"].ToString(), out OLD_GAI_FHI_TAN);


Int64.TryParse(gettbdata.Rows[1]["SAA_TAN"].ToString(),
out OLD_SAA_TAN);
}
else
{
OLD_L_TAN = 0;
OLD_D_TAN = 0;
OLD_NAI_FHI_TAN = 0;
OLD_GAI_FHI_TAN = 0;
OLD_SAA_TAN = 0;
}

result = 0;
}
}
catch (Exception exp)
{
if (MSG_FLG)
HF_MSG("EX61", 99, "HF_VH_M_TANKA_CHK" + "\n" + exp.Message);
result = -1;
}
return result;
}

//****************************************************************************
//* 発注残取得
//*
//* 引 数 : argSHOHIN_NO 発注残を取得する商品番号
//* rtnHACHU_ZAN_D 仕向国外区分="D"の集計値を編集
//* rtnHACHU_ZAN_E 仕向国外区分="E"の集計値を編集
//* 戻り値 : -1 : DB参照エラー
//* 0 : 正常終了
//*
//****************************************************************************
public static int HF_HACHU_ZAN_GET(string argSHOHIN_NO, out decimal
rtnHACHU_ZAN_D, out decimal rtnHACHU_ZAN_E)
{
int result = -1;
rtnHACHU_ZAN_D = 0;
rtnHACHU_ZAN_E = 0;
DatabaseService ds = new DatabaseService();
try
{
// メッセージ応答時にキー入力が使用できるようにする
//SetImeMode(GetActiveWindow, imClose)
if (SQLMapHelper.IsTransaction)
SQLMapHelper.RollbackTransaction();

SQLMapHelper.StartTransaction();

Dictionary<string, string> reqParamQuery = new Dictionary<string,


string>();
reqParamQuery.Add("argSHOHIN_NO", argSHOHIN_NO);
DatabaseServiceResult dbr =
ds.SelectRequestCom(@"VH_T_HAT.selectBySHOHIN_NOAndSMK_EX_KB", reqParamQuery);

if (SQLMapHelper.IsTransaction)
SQLMapHelper.CommitTransaction();

if (dbr.ResultArray.First().Count > 0)
{
//Dictionary<string, string> data;
//data = dbr.ResultArray.First().Data.ToDictionaryStringString();
DataTable gettbdata = dbr.ResultArray[0].Data.ToDataTable();
if (gettbdata.Rows[0]["SMK_EX_KB"].ToString() == ('D').ToString())
{
Decimal.TryParse(gettbdata.Rows[0]["ZAN_SUU"].ToString(), out
rtnHACHU_ZAN_D);
if (gettbdata.Rows.Count > 1)
{
Decimal.TryParse(gettbdata.Rows[1]["ZAN_SUU"].ToString(), out
rtnHACHU_ZAN_E);
}
}
else
{
Decimal.TryParse(gettbdata.Rows[0]["ZAN_SUU"].ToString(), out
rtnHACHU_ZAN_E);
}
}
result = 0;
}
catch (Exception exp)
{
Console.WriteLine("{0} Exception caught.", exp);
}
return result;
}

<?xml version="1.0" encoding="utf-8" ?>


<sqlMap namespace="VH_M_TANKA"
xmlns="http://ibatis.apache.org/mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<statements>

<!-- select By SHOHIN_NO And KAITEI_YMD -->


<select id="selectBySHOHIN_NOAndKAITEI_YMD"
resultClass="System.Collections.Specialized.OrderedDictionary">
SELECT
KAITEI_YMD, L_TAN, D_TAN, NAI_FHI_TAN,GAI_FHI_TAN, SAA_TAN, KAI_RIYU_CD
FROM
VH_M_TANKA
WHERE
<![CDATA[
SHOHIN_NO = prmSHOHIN_NO
AND
KAITEI_YMD <= prmKAITEI_YMD
]]>
ORDER BY
KAITEI_YMD desc
</select>

</statements>
</sqlMap>

<sqlMap resource="./App_Data/Maps/VH_M_TANKA.xml" />

You might also like