Esempio n. 1
0
        public void GetConstValue(FactoryArgs args, t_String FieldName,
                                  t_String ConstValue, out t_String ConstText)
        {
            ConstText = new t_String();
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("FieldName", FieldName));
            parms.Add(new LBDbParameter("ConstValue", ConstValue));
            parms.Add(new LBDbParameter("ConstText", ConstText, true));
            string strSQL = @"
                select @ConstText = ConstText
                from dbo.DbSystemConst
                where FieldName=@FieldName and ConstValue = @ConstValue
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
            ConstText.SetValueWithObject(parms["ConstText"].Value);
        }
Esempio n. 2
0
        public void Update(FactoryArgs args, t_BigID UOMID, t_String UOMName, t_Byte UOMType)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("UOMID", UOMID));
            parms.Add(new LBDbParameter("UOMName", UOMName));
            parms.Add(new LBDbParameter("UOMType", UOMType));

            string strSQL = @"
update dbo.DbUOM
set UOMName=@UOMName, 
    UOMType=@UOMType
where UOMID = @UOMID

";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Esempio n. 3
0
        public void UpdateReportTemplate(FactoryArgs args,
                                         t_BigID ReportTemplateID, t_DTSmall TemplateFileTime, t_Image TemplateData)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("ReportTemplateID", ReportTemplateID));
            parms.Add(new LBDbParameter("TemplateFileTime", TemplateFileTime));
            parms.Add(new LBDbParameter("TemplateData", TemplateData));
            string strSQL = @"
update dbo.DbReportTemplate
set TemplateFileTime=@TemplateFileTime,
    TemplateData=isnull(@TemplateData,TemplateData)
where ReportTemplateID = @ReportTemplateID

";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Esempio n. 4
0
        public void Forbid(FactoryArgs args, t_BigID CustomerID)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("CustomerID", CustomerID));
            parms.Add(new LBDbParameter("ForbidBy", new t_String(args.LoginName)));
            parms.Add(new LBDbParameter("ForbidTime", new t_DTSmall(DateTime.Now)));

            string strSQL = @"
update dbo.DbCustomer
set IsForbid = 1, 
    ForbidBy=@ForbidBy, 
    ForbidTime=@ForbidTime
where CustomerID =  @CustomerID
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Esempio n. 5
0
        public void Update(FactoryArgs args, t_BigID WeightTypeID,
                           t_ID WeightType, t_String MachineName)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("WeightTypeID", WeightTypeID));
            parms.Add(new LBDbParameter("WeightType", WeightType));
            parms.Add(new LBDbParameter("MachineName", MachineName));

            string strSQL = @"
update dbo.DbWeightType
set WeightType=@WeightType,   
    MachineName=@MachineName
where WeightTypeID = @WeightTypeID
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
        public void Cancel(FactoryArgs args, t_BigID ReceiveBillHeaderID)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("ReceiveBillHeaderID", ReceiveBillHeaderID));
            parms.Add(new LBDbParameter("CancelBy", new t_String(args.LoginName)));

            string strSQL = @"
update dbo.RPReceiveBillHeader
set IsCancel = 1,
    CancelTime = getdate(),
    CancelBy = @CancelBy
where ReceiveBillHeaderID = @ReceiveBillHeaderID

";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
        public void Cancel(FactoryArgs args, t_BigID SaleCarInBillID, t_String CancelDesc)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("SaleCarInBillID", SaleCarInBillID));
            parms.Add(new LBDbParameter("CancelBy", new t_String(args.LoginName)));
            parms.Add(new LBDbParameter("CancelDesc", CancelDesc));
            string strSQL = @"
                update dbo.SaleCarInBill
                set IsCancel=1,
                    CancelBy = @CancelBy,
                    CancelTime = datetime('now','localtime'),
                    CancelDesc = @CancelDesc
                where SaleCarInBillID = @SaleCarInBillID
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Esempio n. 8
0
        public void Cancel(FactoryArgs args, t_BigID ModifyBillHeaderID)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("ModifyBillHeaderID", ModifyBillHeaderID));
            parms.Add(new LBDbParameter("CancelBy", new t_String(args.LoginName)));
            parms.Add(new LBDbParameter("CancelTime", new t_DTSmall(DateTime.Now)));

            string strSQL = @"
update dbo.ModifyBillHeader
set IsCancel = 1,
    CancelBy = @CancelBy,
    CancelTime = @CancelTime
where ModifyBillHeaderID = @ModifyBillHeaderID
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Esempio n. 9
0
        private long SaveInBill()
        {
            Dictionary <string, double> dictTest = new Dictionary <string, double>();
            DateTime dt1 = DateTime.Now;
            DateTime dt2 = DateTime.Now;
            long     lSaleCarInBillID = 0;
            long     lCarID           = LBConverter.ToInt64(this.txtCarID.TextBox.SelectedItemID);
            long     lSupplierID      = LBConverter.ToInt64(this.txtSupplierID.TextBox.SelectedItemID);
            decimal  decCarTare       = LBConverter.ToDecimal(this.txtCarTare.Text);
            decimal  decTotalWeight   = LBConverter.ToDecimal(this.txtTotalWeight.Text);
            decimal  decSuttleWeight  = LBConverter.ToDecimal(this.txtSuttleWeight.Text);
            DateTime dtDate           = Convert.ToDateTime(txtBillDateIn.Text + " " + this.txtBillTimeIn.Text);

            if (decCarTare == 0)
            {
                throw new Exception("当前【皮重】值为0,无法保存!");
            }
            if (decTotalWeight == 0)
            {
                throw new Exception("当前【毛重】值为0,无法保存!");
            }
            if (decSuttleWeight <= 0)
            {
                throw new Exception("当前【净重】值为0,无法保存!");
            }

            LBDbParameterCollection parmCol = new LBDbParameterCollection();

            parmCol.Add(new LBParameter("SaleCarInBillID", enLBDbType.Int64, 0));
            parmCol.Add(new LBParameter("SaleCarInBillCode", enLBDbType.String, ""));
            parmCol.Add(new LBParameter("BillDate", enLBDbType.DateTime, dtDate));
            parmCol.Add(new LBParameter("CarID", enLBDbType.Int64, lCarID));
            parmCol.Add(new LBParameter("SupplierID", enLBDbType.Int64, lSupplierID));
            parmCol.Add(new LBParameter("CarTare", enLBDbType.Decimal, decCarTare));
            parmCol.Add(new LBParameter("TotalWeight", enLBDbType.Decimal, decTotalWeight));
            parmCol.Add(new LBParameter("SuttleWeight", enLBDbType.Decimal, decTotalWeight - decCarTare));
            parmCol.Add(new LBParameter("CardCode", enLBDbType.String, ""));

            DataSet dsReturn;
            Dictionary <string, object> dictValue;

            ExecuteSQL.CallSP(14100, parmCol, out dsReturn, out dictValue);
            if (dictValue.ContainsKey("SaleCarInBillID"))
            {
                lSaleCarInBillID = LBConverter.ToInt64(dictValue["SaleCarInBillID"]);
            }

            return(lSaleCarInBillID);
        }
Esempio n. 10
0
        public void GetUserPermission(FactoryArgs args, t_BigID UserID, t_String PermissionCode,
                                      out t_String PermissionDataName, out t_String PermissionName, out t_Bool HasPermission)
        {
            PermissionDataName = new t_String();
            PermissionName     = new t_String();
            HasPermission      = new t_Bool(1);
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("UserID", UserID));
            parms.Add(new LBDbParameter("PermissionCode", PermissionCode));
            parms.Add(new LBDbParameter("PermissionDataName", PermissionDataName, true));
            parms.Add(new LBDbParameter("PermissionName", PermissionName, true));
            parms.Add(new LBDbParameter("HasPermission", HasPermission, true));
            string strSQL = @"
declare @PermissionID   bigint
declare @PermissionDataID   bigint

set @HasPermission = 0

select top 1 @PermissionID = d.PermissionID,@PermissionDataName = d.PermissionDataName,
    @PermissionName = p.PermissionName,@PermissionDataID = d.PermissionDataID
from dbo.DbPermissionData d
    inner join dbo.DbPermission p on
       p.PermissionID = d.PermissionID
where PermissionCode= @PermissionCode

select @HasPermission = isnull(HasPermission,0)
from dbo.DbUserPermission p
where PermissionID = @PermissionID and UserID = @UserID

if @HasPermission = 0
begin
    select @HasPermission = isnull(HasPermission,0)
    from dbo.DbUserPermissionData
    where PermissionDataID=@PermissionDataID and UserID = @UserID
end

";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
            PermissionDataName.SetValueWithObject(parms["PermissionDataName"].Value);
            PermissionName.SetValueWithObject(parms["PermissionName"].Value);
            HasPermission.SetValueWithObject(Convert.ToByte(parms["HasPermission"].Value));
        }
Esempio n. 11
0
        public void InsertPermission(FactoryArgs args, out t_BigID PermissionID, t_BigID ParentPermissionID, t_String PermissionName)
        {
            PermissionID = new t_BigID();
            ParentPermissionID.NullIfZero();
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("PermissionID", PermissionID, true));
            parms.Add(new LBDbParameter("PermissionName", PermissionName));
            parms.Add(new LBDbParameter("ParentPermissionID", ParentPermissionID));
            string strSQL = @"
insert into dbo.DbPermission( PermissionName, ParentPermissionID)
values( @PermissionName, @ParentPermissionID)

set @PermissionID = @@identity
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
            PermissionID.SetValueWithObject(parms["PermissionID"].Value);
        }
Esempio n. 12
0
        public void Insert(FactoryArgs args, t_BigID CarID, t_Decimal CarWeight, t_String Description)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("CarID", CarID));
            parms.Add(new LBDbParameter("CarWeight", CarWeight));
            parms.Add(new LBDbParameter("Description", Description));
            parms.Add(new LBDbParameter("CreateBy", new t_String(args.LoginName)));
            parms.Add(new LBDbParameter("CreateTime", new t_DTSmall(DateTime.Now)));

            string strSQL = @"
insert into dbo.DbCarWeight(CarID,CarWeight,Description,CreateBy, CreateTime)
values( @CarID, @CarWeight, @Description, @CreateBy, @CreateTime)

set @CarID = @@identity
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Esempio n. 13
0
        public static DataTable GetReportTemplateByID4Print(long lReportTemplateID)
        {
            DataTable dtTemplate = null;
            //记录磅单打印次数
            LBDbParameterCollection parmCol = new LBDbParameterCollection();

            parmCol.Add(new LBParameter("ReportTemplateID", enLBDbType.Int64, lReportTemplateID));
            parmCol.Add(new LBParameter("MachineName", enLBDbType.String, LoginInfo.MachineName));

            DataSet dsReturn;
            Dictionary <string, object> dictValue;

            ExecuteSQL.CallSP(12006, parmCol, out dsReturn, out dictValue);
            if (dsReturn != null && dsReturn.Tables.Count > 0)
            {
                dtTemplate = dsReturn.Tables[0];
            }
            return(dtTemplate);
        }
Esempio n. 14
0
        public void UpdateInBillPurchase(FactoryArgs args, t_BigID SaleCarInBillID, t_Decimal CarTare)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("SaleCarInBillID", SaleCarInBillID));
            parms.Add(new LBDbParameter("CarTare", CarTare));
            parms.Add(new LBDbParameter("CreateBy", new t_String(args.LoginName)));

            string strSQL = @"
update dbo.SaleCarInBill
set CarTare = @CarTare,
    CreateBy = @CreateBy,
    BillDate = getdate(),
    CreateTime = getdate()
where SaleCarInBillID = @SaleCarInBillID
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Esempio n. 15
0
        public void Insert(FactoryArgs args, out t_BigID ReportViewID,
                           t_String ReportViewName, t_nText ReportDataSource)
        {
            ReportViewID = new t_BigID();
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("ReportViewID", ReportViewID, true));
            parms.Add(new LBDbParameter("ReportViewName", ReportViewName));
            parms.Add(new LBDbParameter("ReportDataSource", ReportDataSource));
            string strSQL = @"
insert dbo.DbReportView( ReportViewName,ReportDataSource)
values(@ReportViewName,@ReportDataSource)

set @ReportViewID = @@identity
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
            ReportViewID.SetValueWithObject(parms["ReportViewID"].Value);
        }
Esempio n. 16
0
        public void UpdateField(FactoryArgs args, t_BigID ReportViewFieldID,
                                t_String FieldName, t_ID FieldType, t_String FieldText)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("ReportViewFieldID", ReportViewFieldID));
            parms.Add(new LBDbParameter("FieldName", FieldName));
            parms.Add(new LBDbParameter("FieldType", FieldType));
            parms.Add(new LBDbParameter("FieldText", FieldText));
            string strSQL = @"
update dbo.DbReportViewField
set FieldName=@FieldName,
    FieldType=@FieldType,
    FieldText = @FieldText
where ReportViewFieldID = @ReportViewFieldID
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Esempio n. 17
0
        public void Insert(FactoryArgs args, out t_BigID UOMID, t_String UOMName, t_Byte UOMType)
        {
            UOMID = new t_BigID();
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("UOMID", UOMID, true));
            parms.Add(new LBDbParameter("UOMName", UOMName));
            parms.Add(new LBDbParameter("UOMType", UOMType));

            string strSQL = @"
insert into dbo.DbUOM( UOMName, UOMType)
values( @UOMName, @UOMType)

set @UOMID = @@identity
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
            UOMID.Value = Convert.ToInt64(parms["UOMID"].Value);
        }
Esempio n. 18
0
        public DataTable GetReportTemplateByID(FactoryArgs args, t_BigID ReportTemplateID, t_String MachineName)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("MachineName", MachineName));
            parms.Add(new LBDbParameter("ReportTemplateID", ReportTemplateID));
            string    strSQL   = @"
select *
from dbo.DbReportTemplate d
    left outer join dbo.DbPrinterConfig p on
        p.ReportTemplateID = d.ReportTemplateID and
        p.MachineName = @MachineName
where d.ReportTemplateID = @ReportTemplateID
order by d.TemplateFileTime desc
";
            DataTable dtReturn = DBHelper.ExecuteQuery(args, strSQL, parms);

            return(dtReturn);
        }
Esempio n. 19
0
        public void Insert(FactoryArgs args, out t_BigID SysViewTypeID, t_String SysViewType, t_String SysViewName)
        {
            SysViewTypeID = new t_BigID();
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("SysViewTypeID", SysViewTypeID, true));
            parms.Add(new LBDbParameter("SysViewType", SysViewType));
            parms.Add(new LBDbParameter("SysViewName", SysViewName));

            string strSQL = @"
insert into dbo.SysViewType( SysViewType, SysViewName)
values( @SysViewType, @SysViewName)

set @SysViewTypeID = @@identity
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
            SysViewTypeID.SetValueWithObject(Convert.ToInt64(parms["SysViewTypeID"].Value));
        }
Esempio n. 20
0
        private void ReadMonitoreImg(object objWeightLogID)
        {
            try
            {
                long   lWeightLogID          = LBConverter.ToInt64(objWeightLogID);
                byte[] PicInWeightCamera     = null;
                byte[] PicInWeightScreen     = null;
                byte[] PicSteadyWeightCamera = null;
                byte[] PicSteadyWeightScreen = null;
                byte[] PicOutWeightCamera    = null;
                byte[] PicOutWeightScreen    = null;

                LBDbParameterCollection parmCol = new LBDbParameterCollection();
                parmCol.Add(new LBParameter("WeightLogID", enLBDbType.Int64, lWeightLogID));

                DataSet dsReturn;
                Dictionary <string, object> dictValue;
                ExecuteSQL.CallSP(14903, parmCol, out dsReturn, out dictValue);
                if (dictValue.ContainsKey("InWeightCamera"))
                {
                    PicInWeightCamera = dictValue["InWeightCamera"] as byte[];
                }
                if (dictValue.ContainsKey("InWeightScreen"))
                {
                    PicInWeightScreen = dictValue["InWeightScreen"] as byte[];
                }
                if (dictValue.ContainsKey("SteadyWeightCamera"))
                {
                    PicSteadyWeightCamera = dictValue["SteadyWeightCamera"] as byte[];
                }
                if (dictValue.ContainsKey("SteadyWeightScreen"))
                {
                    PicSteadyWeightScreen = dictValue["SteadyWeightScreen"] as byte[];
                }
                if (dictValue.ContainsKey("OutWeightCamera"))
                {
                    PicOutWeightCamera = dictValue["OutWeightCamera"] as byte[];
                }
                if (dictValue.ContainsKey("OutWeightScreen"))
                {
                    PicOutWeightScreen = dictValue["OutWeightScreen"] as byte[];
                }


                SetImage(pbInCamera, PicInWeightCamera);
                SetImage(pbInScreen, PicInWeightScreen);
                SetImage(pbSteadyCamera, PicSteadyWeightCamera);
                SetImage(pbSteadyScreen, PicSteadyWeightScreen);
                SetImage(pbOutCamera, PicOutWeightCamera);
                SetImage(pbOutScreen, PicOutWeightScreen);
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 21
0
        public void Insert(FactoryArgs args,
                           out t_BigID BackUpConfigID, t_ID BackUpType, t_ID BackUpWeek, t_ID BackUpHour, t_ID BackUpMinu, t_Bool IsEffect,
                           t_ID BackUpFileMaxNum, t_String BackUpPath, t_String BackUpName)
        {
            BackUpConfigID = new t_BigID();
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("BackUpConfigID", BackUpConfigID, true));
            parms.Add(new LBDbParameter("BackUpType", BackUpType));
            parms.Add(new LBDbParameter("BackUpWeek", BackUpWeek));
            parms.Add(new LBDbParameter("BackUpHour", BackUpHour));
            parms.Add(new LBDbParameter("BackUpMinu", BackUpMinu));
            parms.Add(new LBDbParameter("IsEffect", IsEffect));
            parms.Add(new LBDbParameter("BackUpFileMaxNum", BackUpFileMaxNum));
            parms.Add(new LBDbParameter("BackUpPath", BackUpPath));
            parms.Add(new LBDbParameter("BackUpName", BackUpName));
            parms.Add(new LBDbParameter("ChangedBy", new t_String(args.LoginName)));

            string strSQL = @"
insert into dbo.DbBackUpConfig( BackUpType, BackUpWeek, BackUpHour, BackUpMinu, IsEffect, 
BackUpFileMaxNum, ChangedBy, ChangedTime, BackUpPath, BackUpName)
values( @BackUpType, @BackUpWeek, @BackUpHour, @BackUpMinu, @IsEffect, 
@BackUpFileMaxNum, @ChangedBy, datetime('now','localtime'), @BackUpPath, @BackUpName);

select last_insert_rowid() as BackUpConfigID;

";

            if (args.DBType == 1)
            {
                strSQL = @"
insert into dbo.DbBackUpConfig( BackUpType, BackUpWeek, BackUpHour, BackUpMinu, IsEffect, 
BackUpFileMaxNum, ChangedBy, ChangedTime, BackUpPath, BackUpName)
values( @BackUpType, @BackUpWeek, @BackUpHour, @BackUpMinu, @IsEffect, 
@BackUpFileMaxNum, @ChangedBy, getdate(), @BackUpPath, @BackUpName)

select @@identity as BackUpConfigID
";
            }
            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
            BackUpConfigID.SetValueWithObject(parms["BackUpConfigID"].Value);
        }
Esempio n. 22
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                this.VerifyTextBoxIsEmpty();//校验控件是否为空

                string  strWeightTypeDesc = "";
                decimal decCarWeight;
                if (rbDevice.Checked)
                {
                    decimal.TryParse(this.lblWeight.Text, out decCarWeight);
                    strWeightTypeDesc = "地磅称重";
                }
                else
                {
                    decimal.TryParse(this.txtCarWeight.Text, out decCarWeight);
                    strWeightTypeDesc = "手动输入重量";
                }

                if (decCarWeight <= 0)
                {
                    LB.WinFunction.LBCommonHelper.ShowCommonMessage("皮重值必须大于0!");
                    return;
                }

                int iSPType = 20400;
                LBDbParameterCollection parmCol = new LBDbParameterCollection();
                parmCol.Add(new LBParameter("CarID", enLBDbType.Int64, mlCarID));
                parmCol.Add(new LBParameter("CarWeight", enLBDbType.Decimal, decCarWeight));
                parmCol.Add(new LBParameter("Description", enLBDbType.String, "皮重值来源:手工新增车辆皮重-[" + strWeightTypeDesc + "]"));

                DataSet dsReturn;
                Dictionary <string, object> dictValue;
                ExecuteSQL.CallSP(iSPType, parmCol, out dsReturn, out dictValue);
                LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!");
                this.Close();
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Esempio n. 23
0
        public void CardConfig(FactoryArgs args, t_String ReadCardSerialCOM, t_String WriteCardSerialCOM,
                               t_ID ReadCardBaud, t_String MachineName,
                               t_ID UseReadCard, t_ID UseWriteCard,
                               t_ID ConnectType, t_String IPAddress, t_ID IPPort)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("ReadCardSerialCOM", ReadCardSerialCOM));
            parms.Add(new LBDbParameter("WriteCardSerialCOM", WriteCardSerialCOM));
            parms.Add(new LBDbParameter("ReadCardBaud", ReadCardBaud));
            parms.Add(new LBDbParameter("MachineName", MachineName));
            parms.Add(new LBDbParameter("UseReadCard", UseReadCard));
            parms.Add(new LBDbParameter("UseWriteCard", UseWriteCard));
            parms.Add(new LBDbParameter("ConnectType", ConnectType));
            parms.Add(new LBDbParameter("IPAddress", IPAddress));
            parms.Add(new LBDbParameter("IPPort", IPPort));

            string strSQL = @"
select 1 from DbCardConfig where rtrim(MachineName)=rtrim(@MachineName)
";

            using (DataTable dtResult = DBHelper.ExecuteQuery(args, strSQL, parms))
            {
                if (dtResult.Rows.Count > 0)
                {
                    strSQL = @"
update  DbCardConfig
set ReadCardSerialCOM = @ReadCardSerialCOM,
    WriteCardSerialCOM = @WriteCardSerialCOM,
    ReadCardBaud = @ReadCardBaud,
    UseReadCard = @UseReadCard,
    UseWriteCard = @UseWriteCard,
    ConnectType = @ConnectType,
    IPAddress = @IPAddress,
    IPPort = @IPPort
where rtrim(MachineName)=rtrim(@MachineName)";
                }
                else
                {
                    strSQL = @"
insert into  DbCardConfig(ReadCardSerialCOM,WriteCardSerialCOM,ReadCardBaud,MachineName,
    ConnectType,IPAddress,IPPort)
values(@ReadCardSerialCOM,@WriteCardSerialCOM,@ReadCardBaud,@MachineName,@ConnectType,@IPAddress,@IPPort)";
                }
                DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
            }
        }
Esempio n. 24
0
        public void Insert(FactoryArgs args, out t_BigID ItemTypeID, t_String ItemTypeName)
        {
            ItemTypeID = new t_BigID();
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("ItemTypeID", ItemTypeID, true));
            parms.Add(new LBDbParameter("ItemTypeName", ItemTypeName));
            parms.Add(new LBDbParameter("ChangeBy", new t_String(args.LoginName)));
            parms.Add(new LBDbParameter("ChangeTime", new t_DTSmall(DateTime.Now)));

            string strSQL = @"
insert into dbo.DbItemType( ItemTypeName, ChangeBy, ChangeTime)
values( @ItemTypeName, @ChangeBy, @ChangeTime)

set @ItemTypeID = @@identity
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
            ItemTypeID.Value = Convert.ToInt64(parms["ItemTypeID"].Value);
        }
Esempio n. 25
0
        public void Update(FactoryArgs args, t_BigID ItemTypeID, t_String ItemTypeName)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("ItemTypeID", ItemTypeID));
            parms.Add(new LBDbParameter("ItemTypeName", ItemTypeName));
            parms.Add(new LBDbParameter("ChangeBy", new t_String(args.LoginName)));
            parms.Add(new LBDbParameter("ChangeTime", new t_DTSmall(DateTime.Now)));

            string strSQL = @"
update dbo.DbItemType
set ItemTypeName=@ItemTypeName,
    ChangeBy=@ChangeBy,
    ChangeTime=@ChangeTime 
where ItemTypeID = @ItemTypeID

";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Esempio n. 26
0
        public void UpdateAmount(FactoryArgs args, t_BigID CustomerID, t_Decimal TotalReceivedAmount, t_Decimal SalesReceivedAmount)
        {
            TotalReceivedAmount.IsNullToZero();
            SalesReceivedAmount.IsNullToZero();

            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("CustomerID", CustomerID));
            parms.Add(new LBDbParameter("TotalReceivedAmount", TotalReceivedAmount));
            parms.Add(new LBDbParameter("SalesReceivedAmount", SalesReceivedAmount));

            string strSQL = @"
update dbo.DbCustomer
set TotalReceivedAmount = @TotalReceivedAmount, 
    SalesReceivedAmount=@SalesReceivedAmount
where CustomerID =  @CustomerID
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Esempio n. 27
0
        public void Update(FactoryArgs args,
                           t_BigID DescriptionID, t_String Description)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("DescriptionID", DescriptionID));
            parms.Add(new LBDbParameter("Description", Description));
            parms.Add(new LBDbParameter("ChangedBy", new t_String(args.LoginName)));

            string strSQL = @"
update dbo.DbDescription
set Description=@Description,   
    ChangedBy=@ChangedBy,  
    ChangeTime=getdate()
where DescriptionID = @DescriptionID

";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Esempio n. 28
0
        public void Delete(FactoryArgs args, t_BigID SessionID)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("SessionID", SessionID));
            string strSQL = @"
                delete dbo.SysSession
                where SessionID = @SessionID";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Esempio n. 29
0
        public DataTable GetSMItemPrice(FactoryArgs args, t_BigID CustomerID, t_BigID CarID, t_BigID ItemID, t_ID CalculateType)
        {
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("CustomerID", CustomerID));
            parms.Add(new LBDbParameter("CarID", CarID));
            parms.Add(new LBDbParameter("ItemID", ItemID));
            parms.Add(new LBDbParameter("CalculateType", CalculateType));
            string strSQL = @"

    select *
    from dbo.SMItemPrice
    where CustomerID=@CustomerID and
        CarID=@CarID and
        ItemID=@ItemID and
        CalculateType=@CalculateType 
";

            return(DBHelper.ExecuteQuery(args, strSQL, parms));
        }
Esempio n. 30
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                this.VerifyTextBoxIsEmpty();//校验控件是否为空

                long lSupplierID = LBConverter.ToInt64(this.txtSupplierID.SelectedValue);
                long lCardID     = LBConverter.ToInt64(this.txtCardID.SelectedValue);
                //先判断该卡片是否已绑定了其他车辆,提示用户是否取消绑定
                if (lCardID > 0)
                {
                    string strBindCarNum;
                    bool   bolExists = this.GetCardRefCarInfo(lCardID, out strBindCarNum);
                    if (bolExists)
                    {
                        if (LB.WinFunction.LBCommonHelper.ConfirmMessage("该卡号已关联车牌【" + strBindCarNum + "】,是否取消与该车牌的关联?", "提示", MessageBoxButtons.YesNo) != DialogResult.Yes)
                        {
                            return;
                        }
                    }
                }

                int iSPType = 13500;
                if (mlCarID > 0)
                {
                    iSPType = 13501;
                }

                LBDbParameterCollection parmCol = new LBDbParameterCollection();
                parmCol.Add(new LBParameter("SupplierID", enLBDbType.Int64, lSupplierID));
                parmCol.Add(new LBParameter("CardID", enLBDbType.Int64, lCardID));
                parmCol.Add(new LBParameter("CarID", enLBDbType.Int64, mlCarID));
                parmCol.Add(new LBParameter("CarNum", enLBDbType.String, this.txtCarNum.Text));
                parmCol.Add(new LBParameter("CarCode", enLBDbType.String, this.txtCarCode.Text));
                parmCol.Add(new LBParameter("Description", enLBDbType.String, this.txtDescription.Text));
                parmCol.Add(new LBParameter("DefaultCarWeight", enLBDbType.Decimal, LBConverter.ToDecimal(this.txtDefaultCarWeight.Text)));

                DataSet dsReturn;
                Dictionary <string, object> dictValue;
                ExecuteSQL.CallSP(iSPType, parmCol, out dsReturn, out dictValue);
                if (dictValue.ContainsKey("CarID"))
                {
                    mlCarID = LBConverter.ToInt64(dictValue["CarID"]);
                }
                if (dictValue.ContainsKey("CarCode"))
                {
                    this.txtCarCode.Text = dictValue["CarCode"].ToString();
                }
                LB.WinFunction.LBCommonHelper.ShowCommonMessage("保存成功!");
                SetButtonStatus();
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }