コード例 #1
0
        /// <summary>
        /// 插入一条明细记录
        /// </summary>
        /// <param name="OprObject"></param>
        /// <returns></returns>
        public int Insert(clsSaleRecord OprObject, out string sErrMsg)
        {
            sErrMsg = string.Empty;
            int rtn = 0;

            try
            {
                string insertSql = "insert into tSaleRecord(SysCode,StdCode,CompanyID,CompanyName,DisplayName,SaleDate,FoodID,FoodName,Model,SaleNumber,Price,Unit,PurchaserID,PurchaserName,LinkInfo,LinkMan,MakeMan,Remark,DistrictCode)"
                                   + " values('"
                                   + OprObject.SysCode + "','"
                                   + OprObject.StdCode + "','"
                                   + OprObject.CompanyID + "','"
                                   + OprObject.CompanyName + "','"
                                   + OprObject.DisplayName + "','"
                                   + OprObject.SaleDate + "','"
                                   + OprObject.FoodID + "','"
                                   + OprObject.FoodName + "','"
                                   + OprObject.Model + "',"
                                   + OprObject.SaleNumber + ","
                                   + OprObject.Price + ",'"
                                   + OprObject.Unit + "','"
                                   + OprObject.PurchaserID + "','"
                                   + OprObject.PurchaserName + "','"
                                   + OprObject.LinkInfo + "','"
                                   + OprObject.LinkMan + "','"
                                   + OprObject.MakeMan + "','"
                                   + OprObject.Remark + "','"
                                   + OprObject.DistrictCode + "')";
                DataBase.ExecuteCommand(insertSql, out sErrMsg);

                rtn = 1;
            }
            catch (Exception e)
            {
                //				Log.WriteLog("添加tSaleRecord",e);
                sErrMsg = e.Message;
            }

            return(rtn);
        }
コード例 #2
0
        /// <summary>
        /// 部分修改保存
        /// </summary>
        /// <param name="OprObject">对象clsSaleRecord的一个实例参数</param>
        /// <returns></returns>
        public int UpdatePart(clsSaleRecord OprObject, string sOldCode, out string sErrMsg)
        {
            sErrMsg = string.Empty;
            int rtn = 0;

            try
            {
                string updateSql = "update tSaleRecord set "
                                   + "StdCode='" + OprObject.StdCode + "',"
                                   + "CompanyID='" + OprObject.CompanyID + "',"
                                   + "CompanyName='" + OprObject.CompanyName + "',"
                                   + "DisplayName='" + OprObject.DisplayName + "',"
                                   + "SaleDate='" + OprObject.SaleDate + "',"
                                   + "FoodID='" + OprObject.FoodID + "',"
                                   + "FoodName='" + OprObject.FoodName + "',"
                                   + "Model='" + OprObject.Model + "',"
                                   + "SaleNumber=" + OprObject.SaleNumber + ","
                                   + "Price=" + OprObject.Price + ","
                                   + "Unit='" + OprObject.Unit + "',"
                                   + "PurchaserID='" + OprObject.PurchaserID + "',"
                                   + "PurchaserName='" + OprObject.PurchaserName + "',"
                                   + "LinkInfo='" + OprObject.LinkInfo + "',"
                                   + "LinkMan='" + OprObject.LinkMan + "',"
                                   + "MakeMan='" + OprObject.MakeMan + "',"
                                   + "Remark='" + OprObject.Remark + "', "
                                   + "DistrictCode='" + OprObject.DistrictCode + "' "
                                   + " where SysCode='" + sOldCode + "' ";
                DataBase.ExecuteCommand(updateSql, out sErrMsg);

                rtn = 1;
            }
            catch (Exception e)
            {
                //				Log.WriteLog("更新tSaleRecord",e);
                sErrMsg = e.Message;
            }

            return(rtn);
        }