Exemplo n.º 1
0
        public void UpdateDLMaster(DLInfo oParam)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                new DLDac().Update(oParam);
                scope.Complete();
            }
        }
Exemplo n.º 2
0
        private void InsertDLMaster(DLInfo oParam)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                oParam.SysNo = SequenceDac.GetInstance().Create("DL_Sequence");
                new DLDac().Insert(oParam);
                scope.Complete();
            }
        }
Exemplo n.º 3
0
        public DLInfo Load(int sysno)
        {
            string sql = "select * from DL_Master where sysno =" + sysno;
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            DLInfo oInfo = new DLInfo();
            if (Util.HasMoreRow(ds))
            {
                map(oInfo, ds.Tables[0].Rows[0]);

                //load dlitems
                string sqlItem = "select * from dl_item where dlsysno =" + oInfo.SysNo;
                DataSet dsItem = SqlHelper.ExecuteDataSet(sqlItem);
                if (Util.HasMoreRow(dsItem))
                {
                    foreach (DataRow dr in dsItem.Tables[0].Rows)
                    {
                        DLItemInfo oDLItem = new DLItemInfo();
                        map(oDLItem, dr);
                        oInfo.ItemHash.Add(oDLItem.SysNo, oDLItem);
                    }
                }
                return oInfo;
            }
            else
                return null;
        }
Exemplo n.º 4
0
 public DLInfo LoadDLMaster(int sysno)
 {
     string sql = "select * from DL_Master where sysno =" + sysno;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     DLInfo oInfo = new DLInfo();
     if (Util.HasMoreRow(ds))
     {
         map(oInfo, ds.Tables[0].Rows[0]);
         return oInfo;
     }
     else
         return null;
 }
Exemplo n.º 5
0
        public void CreateDL(DLInfo dlInfo)
        {
            try
            {
                TransactionOptions options = new TransactionOptions();
                options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
                options.Timeout = TransactionManager.DefaultTimeout;

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
                {
                    dlInfo.Status = (int)AppEnum.DLStatus.Origin;
                    dlInfo.CreateTime = DateTime.Now;

                    //�������ͱ�����
                    this.InsertDLMaster(dlInfo);

                    //�������ͱ���ϸ
                    int HasPaidQty = 0;
                    decimal HasPaidAmt = 0;
                    int CODQty = 0;
                    decimal CODAmt = 0;

                    foreach (DLItemInfo item in dlInfo.ItemHash.Values)
                    {
                        item.DLSysNo = dlInfo.SysNo;
                        item.Status = (int)AppEnum.BiStatus.Valid;
                        this.InsertDLItem(item);

                        if (item.PayType == 1) //��������
                        {
                            CODQty++;
                            CODAmt += item.PayAmt;
                        }
                        else
                        {
                            HasPaidQty++;
                            HasPaidAmt += item.PayAmt;
                        }
                    }

                    dlInfo.HasPaidQty = HasPaidQty;
                    dlInfo.HasPaidAmt = HasPaidAmt;
                    dlInfo.CODQty = CODQty;
                    dlInfo.CODAmt = CODAmt;

                    UpdateDLMaster(dlInfo);
                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                dlInfo.SysNo = AppConst.IntNull;
                throw ex;
            }
        }
Exemplo n.º 6
0
        public void ChangeFreight(DLInfo oDLMasterInfo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                //����DL������Ϣ
                UpdateDLMaster(oDLMasterInfo);

                DLInfo oDLInfo = Load(oDLMasterInfo.SysNo);

                //���¸�������������Ϣ

                DeliveryManSetListInfo deliveryInfo = new DeliveryManSetListInfo();
                deliveryInfo.SetUserSysNo = oDLMasterInfo.UpdateFreightManUserSysNo;
                deliveryInfo.FreightUserSysNo = oDLMasterInfo.FreightUserSysNo;
                deliveryInfo.CreateTime = DateTime.Now;
                deliveryInfo.DLSysNo = oDLMasterInfo.SysNo;
                foreach (DLItemInfo oItem in oDLInfo.ItemHash.Values)
                {
                    if (oItem.ItemType == (int)AppEnum.DLItemType.SaleOrder)
                    {
                        Hashtable ht = new Hashtable();
                        ht.Add("freightusersysno", oDLMasterInfo.FreightUserSysNo);
                        ht.Add("SetDeliveryManTime", System.DateTime.Now);
                        ht.Add("DLSysNo", oDLMasterInfo.SysNo);
                        ht.Add("SysNo", Int32.Parse(oItem.ItemID.Substring(1)));
                        SaleManager.GetInstance().UpdateSOMaster(ht);

                    }
                    else if (oItem.ItemType == (int)AppEnum.DLItemType.RMARequest)
                    {
                        Hashtable ht = new Hashtable();
                        ht.Add("freightusersysno", oDLMasterInfo.FreightUserSysNo);
                        ht.Add("SetDeliveryManTime", System.DateTime.Now);
                        ht.Add("DLSysNo", oDLMasterInfo.SysNo);
                        ht.Add("SysNo", Int32.Parse(oItem.ItemID.Substring(2)));
                        RMARequestManager.GetInstance().SetDeliveryMen(ht);
                    }
                    else if (oItem.ItemType == (int)AppEnum.DLItemType.RMARevert)
                    {
                        Hashtable ht = new Hashtable();
                        ht.Add("freightusersysno", oDLMasterInfo.FreightUserSysNo);
                        ht.Add("SetDeliveryManTime", System.DateTime.Now);
                        ht.Add("DLSysNo", oDLMasterInfo.SysNo);
                        ht.Add("SysNo", Int32.Parse(oItem.ItemID.Substring(2)));
                        RMARevertManager.GetInstance().SetDeliveryMen(ht);
                    }
                    else if (oItem.ItemType == (int)AppEnum.DLItemType.RMAOutbound)
                    {
                        Hashtable ht = new Hashtable();
                        ht.Add("freightusersysno", oDLMasterInfo.FreightUserSysNo);
                        ht.Add("SetDeliveryManTime", System.DateTime.Now);
                        ht.Add("DLSysNo", oDLMasterInfo.SysNo);
                        ht.Add("SysNo", Int32.Parse(oItem.ItemID.Substring(2)));
                        RMAOutBoundManager.GetInstance().SetDeliveryMen(ht);
                    }
                    else if (oItem.ItemType == (int)AppEnum.DLItemType.RMASendAccessory)
                    {
                        Hashtable ht = new Hashtable();
                        ht.Add("freightusersysno", oDLMasterInfo.FreightUserSysNo);
                        ht.Add("SetDeliveryManTime", System.DateTime.Now);
                        ht.Add("DLSysNo", oDLMasterInfo.SysNo);
                        ht.Add("SysNo", Int32.Parse(oItem.ItemID.Substring(2)));
                        RMASendAccessoryManager.GetInstance().SetDeliveryMen(ht);
                    }

                    deliveryInfo.ItemID = oItem.ItemID;
                    DeliveryManager.GetInstance().InsertDeliveryMenSetList(deliveryInfo);

                }
                scope.Complete();
            }
        }
Exemplo n.º 7
0
        public void CalcDLMaster(int SysNo)
        {
            string sql1 = "select * from dl_master where sysno=" + SysNo;
            DataSet ds1 = SqlHelper.ExecuteDataSet(sql1);
            DLInfo dlInfo = new DLInfo();
            if (Util.HasMoreRow(ds1))
            {
                map(dlInfo, ds1.Tables[0].Rows[0]);
            }
            else
            {
                return;
            }

            dlInfo.ItemHash.Clear();

            string sql2 = "select * from dl_item where dlsysno=" + SysNo + " and status=@valid";
            sql2 = sql2.Replace("@valid", ((int)AppEnum.BiStatus.Valid).ToString());
            DataSet ds2 = SqlHelper.ExecuteDataSet(sql2);
            if (Util.HasMoreRow(ds2))
            {
                foreach (DataRow dr in ds2.Tables[0].Rows)
                {
                    DLItemInfo item = new DLItemInfo();
                    map(item, dr);
                    dlInfo.ItemHash.Add(item.SysNo, item);
                }
            }

            try
            {
                TransactionOptions options = new TransactionOptions();
                options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
                options.Timeout = TransactionManager.DefaultTimeout;

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
                {
                    int HasPaidQty = 0;
                    decimal HasPaidAmt = 0;
                    int CODQty = 0;
                    decimal CODAmt = 0;

                    foreach (DLItemInfo item in dlInfo.ItemHash.Values)
                    {
                        if (item.PayType == 1) //��������
                        {
                            CODQty++;
                            CODAmt += item.PayAmt;
                        }
                        else
                        {
                            HasPaidQty++;
                            HasPaidAmt += item.PayAmt;
                        }
                    }

                    dlInfo.HasPaidQty = HasPaidQty;
                    dlInfo.HasPaidAmt = HasPaidAmt;
                    dlInfo.CODQty = CODQty;
                    dlInfo.CODAmt = CODAmt;

                    UpdateDLMaster(dlInfo);
                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                dlInfo.SysNo = AppConst.IntNull;
                throw ex;
            }
        }
Exemplo n.º 8
0
 private void map(DLInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.FreightUserSysNo = Util.TrimIntNull(tempdr["FreightUserSysNo"]);
     oParam.CreateUserSysNo = Util.TrimIntNull(tempdr["CreateUserSysNo"]);
     oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]);
     oParam.ConfirmUserSysNo = Util.TrimIntNull(tempdr["ConfirmUserSysNo"]);
     oParam.ConfirmTime = Util.TrimDateNull(tempdr["ConfirmTime"]);
     oParam.IncomeUserSysNo = Util.TrimIntNull(tempdr["IncomeUserSysNo"]);
     oParam.IncomeTime = Util.TrimDateNull(tempdr["IncomeTime"]);
     oParam.UpdateFreightManUserSysNo = Util.TrimIntNull(tempdr["UpdateFreightManUserSysNo"]);
     oParam.UpdateFreightManTime = Util.TrimDateNull(tempdr["UpdateFreightManTime"]);
     oParam.VoucherUserSysNo = Util.TrimIntNull(tempdr["VoucherUserSysNo"]);
     oParam.VoucherID = Util.TrimNull(tempdr["VoucherID"]);
     oParam.VoucherTime = Util.TrimDateNull(tempdr["VoucherTime"]);
     oParam.HasPaidQty = Util.TrimIntNull(tempdr["HasPaidQty"]);
     oParam.HasPaidAmt = Util.TrimDecimalNull(tempdr["HasPaidAmt"]);
     oParam.CODQty = Util.TrimIntNull(tempdr["CODQty"]);
     oParam.CODAmt = Util.TrimDecimalNull(tempdr["CODAmt"]);
     oParam.Type = Util.TrimIntNull(tempdr["Type"]);
     oParam.Status = Util.TrimIntNull(tempdr["Status"]);
     oParam.IsSendSMS = Util.TrimIntNull(tempdr["IsSendSMS"]);
     oParam.IsAllow = Util.TrimIntNull(tempdr["IsAllow"]);
 }
Exemplo n.º 9
0
Arquivo: DLDac.cs Projeto: ue96/ue96
        public int Update(DLInfo oParam)
        {
            string sql = @"UPDATE DL_Master SET
                            FreightUserSysNo=@FreightUserSysNo, CreateUserSysNo=@CreateUserSysNo,
                            CreateTime=@CreateTime, ConfirmUserSysNo=@ConfirmUserSysNo,
                            ConfirmTime=@ConfirmTime, IncomeUserSysNo=@IncomeUserSysNo,
                            IncomeTime=@IncomeTime, UpdateFreightManUserSysNo=@UpdateFreightManUserSysNo,
                            UpdateFreightManTime=@UpdateFreightManTime, VoucherUserSysNo=@VoucherUserSysNo,
                            VoucherID=@VoucherID, VoucherTime=@VoucherTime,
                            HasPaidQty=@HasPaidQty, HasPaidAmt=@HasPaidAmt,
                            CODQty=@CODQty, CODAmt=@CODAmt,
                            Type=@Type, Status=@Status,
                            IsSendSMS=@IsSendSMS, IsAllow=@IsAllow
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramFreightUserSysNo = new SqlParameter("@FreightUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime);
            SqlParameter paramConfirmUserSysNo = new SqlParameter("@ConfirmUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramConfirmTime = new SqlParameter("@ConfirmTime", SqlDbType.DateTime);
            SqlParameter paramIncomeUserSysNo = new SqlParameter("@IncomeUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramIncomeTime = new SqlParameter("@IncomeTime", SqlDbType.DateTime);
            SqlParameter paramUpdateFreightManUserSysNo = new SqlParameter("@UpdateFreightManUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramUpdateFreightManTime = new SqlParameter("@UpdateFreightManTime", SqlDbType.DateTime);
            SqlParameter paramVoucherUserSysNo = new SqlParameter("@VoucherUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramVoucherID = new SqlParameter("@VoucherID", SqlDbType.NVarChar, 50);
            SqlParameter paramVoucherTime = new SqlParameter("@VoucherTime", SqlDbType.DateTime);
            SqlParameter paramHasPaidQty = new SqlParameter("@HasPaidQty", SqlDbType.Int, 4);
            SqlParameter paramHasPaidAmt = new SqlParameter("@HasPaidAmt", SqlDbType.Decimal, 9);
            SqlParameter paramCODQty = new SqlParameter("@CODQty", SqlDbType.Int, 4);
            SqlParameter paramCODAmt = new SqlParameter("@CODAmt", SqlDbType.Decimal, 9);
            SqlParameter paramType = new SqlParameter("@Type", SqlDbType.Int, 4);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);
            SqlParameter paramIsSendSMS = new SqlParameter("@IsSendSMS", SqlDbType.Int, 4);
            SqlParameter paramIsAllow = new SqlParameter("@IsAllow", SqlDbType.Int, 4);

            if (oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if (oParam.FreightUserSysNo != AppConst.IntNull)
                paramFreightUserSysNo.Value = oParam.FreightUserSysNo;
            else
                paramFreightUserSysNo.Value = System.DBNull.Value;
            if (oParam.CreateUserSysNo != AppConst.IntNull)
                paramCreateUserSysNo.Value = oParam.CreateUserSysNo;
            else
                paramCreateUserSysNo.Value = System.DBNull.Value;
            if (oParam.CreateTime != AppConst.DateTimeNull)
                paramCreateTime.Value = oParam.CreateTime;
            else
                paramCreateTime.Value = System.DBNull.Value;
            if (oParam.ConfirmUserSysNo != AppConst.IntNull)
                paramConfirmUserSysNo.Value = oParam.ConfirmUserSysNo;
            else
                paramConfirmUserSysNo.Value = System.DBNull.Value;
            if (oParam.ConfirmTime != AppConst.DateTimeNull)
                paramConfirmTime.Value = oParam.ConfirmTime;
            else
                paramConfirmTime.Value = System.DBNull.Value;
            if (oParam.IncomeUserSysNo != AppConst.IntNull)
                paramIncomeUserSysNo.Value = oParam.IncomeUserSysNo;
            else
                paramIncomeUserSysNo.Value = System.DBNull.Value;
            if (oParam.IncomeTime != AppConst.DateTimeNull)
                paramIncomeTime.Value = oParam.IncomeTime;
            else
                paramIncomeTime.Value = System.DBNull.Value;
            if (oParam.UpdateFreightManUserSysNo != AppConst.IntNull)
                paramUpdateFreightManUserSysNo.Value = oParam.UpdateFreightManUserSysNo;
            else
                paramUpdateFreightManUserSysNo.Value = System.DBNull.Value;
            if (oParam.UpdateFreightManTime != AppConst.DateTimeNull)
                paramUpdateFreightManTime.Value = oParam.UpdateFreightManTime;
            else
                paramUpdateFreightManTime.Value = System.DBNull.Value;
            if (oParam.VoucherUserSysNo != AppConst.IntNull)
                paramVoucherUserSysNo.Value = oParam.VoucherUserSysNo;
            else
                paramVoucherUserSysNo.Value = System.DBNull.Value;
            if (oParam.VoucherID != AppConst.StringNull)
                paramVoucherID.Value = oParam.VoucherID;
            else
                paramVoucherID.Value = System.DBNull.Value;
            if (oParam.VoucherTime != AppConst.DateTimeNull)
                paramVoucherTime.Value = oParam.VoucherTime;
            else
                paramVoucherTime.Value = System.DBNull.Value;
            if (oParam.HasPaidQty != AppConst.IntNull)
                paramHasPaidQty.Value = oParam.HasPaidQty;
            else
                paramHasPaidQty.Value = System.DBNull.Value;
            if (oParam.HasPaidAmt != AppConst.DecimalNull)
                paramHasPaidAmt.Value = oParam.HasPaidAmt;
            else
                paramHasPaidAmt.Value = System.DBNull.Value;
            if (oParam.CODQty != AppConst.IntNull)
                paramCODQty.Value = oParam.CODQty;
            else
                paramCODQty.Value = System.DBNull.Value;
            if (oParam.CODAmt != AppConst.DecimalNull)
                paramCODAmt.Value = oParam.CODAmt;
            else
                paramCODAmt.Value = System.DBNull.Value;
            if (oParam.Type != AppConst.IntNull)
                paramType.Value = oParam.Type;
            else
                paramType.Value = System.DBNull.Value;
            if (oParam.Status != AppConst.IntNull)
                paramStatus.Value = oParam.Status;
            else
                paramStatus.Value = System.DBNull.Value;
            if (oParam.IsSendSMS != AppConst.IntNull)
                paramIsSendSMS.Value = oParam.IsSendSMS;
            else
                paramIsSendSMS.Value = System.DBNull.Value;
            if (oParam.IsAllow != AppConst.IntNull)
                paramIsAllow.Value = oParam.IsAllow;
            else
                paramIsAllow.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramFreightUserSysNo);
            cmd.Parameters.Add(paramCreateUserSysNo);
            cmd.Parameters.Add(paramCreateTime);
            cmd.Parameters.Add(paramConfirmUserSysNo);
            cmd.Parameters.Add(paramConfirmTime);
            cmd.Parameters.Add(paramIncomeUserSysNo);
            cmd.Parameters.Add(paramIncomeTime);
            cmd.Parameters.Add(paramUpdateFreightManUserSysNo);
            cmd.Parameters.Add(paramUpdateFreightManTime);
            cmd.Parameters.Add(paramVoucherUserSysNo);
            cmd.Parameters.Add(paramVoucherID);
            cmd.Parameters.Add(paramVoucherTime);
            cmd.Parameters.Add(paramHasPaidQty);
            cmd.Parameters.Add(paramHasPaidAmt);
            cmd.Parameters.Add(paramCODQty);
            cmd.Parameters.Add(paramCODAmt);
            cmd.Parameters.Add(paramType);
            cmd.Parameters.Add(paramStatus);
            cmd.Parameters.Add(paramIsSendSMS);
            cmd.Parameters.Add(paramIsAllow);

            return SqlHelper.ExecuteNonQuery(cmd);
        }