Example #1
0
        public IHttpActionResult SaveBusinessParty(rfbp1 BusinessParty)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            bool isDone = BusinessPartyHelper.SaveBusinessParty(BusinessParty);

            if (!isDone)
            {
                return(InternalServerError());
            }
            return(Ok());
        }
Example #2
0
        public static rfbp1 GetBusinessParty(string BusinessPartyCode)
        {
            var   connection = ApiService.dbConnection;
            rfbp1 myParty    = null;

            try
            {
                connection.Open();
                myParty = connection.QuerySingleOrDefault <rfbp1>(qryBusinessParty.selectBusinessParty, new { BusinessPartyCode });
            }
            catch (Exception) { throw; }
            finally { connection.Close(); }

            return(myParty);
        }
Example #3
0
        public static bool SaveBusinessParty(rfbp1 BusinessParty)
        {
            var connection = ApiService.dbConnection;
            int afRecCnt   = 0;

            try
            {
                connection.Open();
                int    partyCnt = connection.ExecuteScalar <int>(qryBusinessParty.selectBusinessPartyCount, new { BusinessPartyCode = BusinessParty.BusinessPartyCode });
                string storeProcName;
                if (partyCnt <= 0)
                {
                    // set audit values
                    BusinessParty.WorkStation    = ApiService.HostName;
                    BusinessParty.CreateBy       = ApiService.UserId;
                    BusinessParty.CreateDateTime = ApiService.ClientDate;
                    BusinessParty.UpdateBy       = ApiService.UserId;
                    BusinessParty.UpdateDateTime = ApiService.ClientDate;

                    storeProcName = qryBusinessParty.insertBusinessParty;
                }
                else
                {
                    // set audit values
                    BusinessParty.WorkStation    = ApiService.HostName;
                    BusinessParty.UpdateBy       = ApiService.UserId;
                    BusinessParty.UpdateDateTime = ApiService.ClientDate;

                    storeProcName = qryBusinessParty.updateBusinessParty;
                }

                // execute
                var param = connection.GetStoreProcParams(storeProcName, BusinessParty);
                afRecCnt = connection.Execute(storeProcName, param, null, null, CommandType.StoredProcedure);
            }
            catch (Exception) { throw; }
            finally { connection.Close(); }

            return(afRecCnt > 0 ? true : false);
        }