Beispiel #1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="usercode"></param>
        /// <returns></returns>
        public int DelDictcustomerdiscountByID(string strId)
        {
            int nflag = 0;

            try
            {
                var arrayId = strId.Split(',');
                //临时存储待删除对象,备写日志用
                List <Dictcustomertestdiscount> dictLibraryList = new List <Dictcustomertestdiscount>();
                foreach (string strid in arrayId)
                {
                    dictLibraryList.Add(GetDictcustomerdiscountById(Convert.ToDouble(strid)));
                }
                nflag = this.delete("Dict.DeleteDictcustomertestdiscount", strId);
                CacheHelper.RemoveAllCache("daan.SelectDictcustomertestdiscountresult");
                foreach (Dictcustomertestdiscount item in dictLibraryList)
                {
                    List <LogInfo> logLst             = getLogInfo <Dictcustomertestdiscount>(item, new Dictcustomertestdiscount());
                    Dictcustomer   dictcustomerDelete = new DictCustomerService().GetDictCustomerById(Convert.ToDouble(item.Dictcustomerid));
                    AddMaintenanceLog("Dictcustomertestdiscount", item.Dictcustomerdiscountid, logLst, "删除", dictcustomerDelete.Customername.ToString(), item.Finalprice.ToString(), modulename);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(nflag);
        }
        ///<summary>
        ///新增编辑后保存
        ///</summary>
        ///<param name="library"></param>
        /// <returns></returns>
        public bool SaveDictcustomerdiscounted(Dictcustomerdiscounted library)
        {
            SortedList SQLlist = new SortedList(new MySort());
            int        nflag   = 0;

            //新增
            if (library.Dictcustomerdiscountid == 0 || library.Dictcustomerdiscountid == null)
            {
                try
                {
                    library.Dictcustomerdiscountid = getSeqID("SEQ_DICTCUSTOMERDISCOUNTED");
                    insert("Dict.InsertDictcustomerdiscounted", library);
                    SQLlist.Add(new Hashtable()
                    {
                        { "INSERT", "Dict.InsertDictcustomerdiscounted" }
                    }, library);
                    nflag = 1;
                    List <LogInfo> logLst       = getLogInfo <Dictcustomerdiscounted>(new Dictcustomerdiscounted(), library);
                    Dictcustomer   dictcustomer = new DictCustomerService().GetDictCustomerById(Convert.ToDouble(library.Dictcustomerid));
                    AddMaintenanceLog("Dictcustomerdiscounted", int.Parse(library.Dictcustomerdiscountid.ToString()), logLst, "新增", dictcustomer.Customername.ToString(), library.Sendoutprice.ToString(), modulename);
                    SQLlist.Add(new Hashtable()
                    {
                        { "INSERT", "dict.InsertMaintenancelog" }
                    }, library);
                    CacheHelper.RemoveAllCache("daan.SelectDictcustomerdiscountedresult");
                }
                catch (Exception ex)
                {
                    nflag = 0;
                    throw new Exception(ex.Message);
                }
            }
            else//保存
            {
                try
                {
                    Dictcustomerdiscounted dictcustomer = GetDictcustomerdiscountedById(Convert.ToDouble(library.Dictcustomerdiscountid));
                    nflag = update("Dict.UpdateDictcustomerdiscounted", library);
                    List <LogInfo> logLst             = getLogInfo <Dictcustomerdiscounted>(dictcustomer, library);
                    Dictcustomer   dictcustomerUpdate = new DictCustomerService().GetDictCustomerById(Convert.ToDouble(library.Dictcustomerid));
                    AddMaintenanceLog("Dictcustomerdiscounted", int.Parse(library.Dictcustomerdiscountid.ToString()), logLst, "修改", dictcustomerUpdate.Customername.ToString(), library.Sendoutprice.ToString(), modulename);
                    CacheHelper.RemoveAllCache("daan.SelectDictcustomerdiscountedresult");
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
            return(nflag > 0);
        }
Beispiel #3
0
        ///<summary>
        ///新增编辑后保存
        ///</summary>
        ///<param name="library"></param>
        /// <returns></returns>
        public bool SaveDictcustomerdiscount(Dictcustomertestdiscount library)
        {
            int nflag = 0;

            //新增
            if (library.Dictcustomerdiscountid == 0 || library.Dictcustomerdiscountid == null)
            {
                try
                {
                    library.Dictcustomerdiscountid = getSeqID("SEQ_DICTCUSTOMERTESTDISCOUNT");
                    insert("Dict.InsertDictcustomertestdiscount", library);
                    nflag = 1;
                    List <LogInfo> logLst       = getLogInfo <Dictcustomertestdiscount>(new Dictcustomertestdiscount(), library);
                    Dictcustomer   dictcustomer = new DictCustomerService().GetDictCustomerById(Convert.ToDouble(library.Dictcustomerid));
                    AddMaintenanceLog("Dictcustomertestdiscount", int.Parse(library.Dictcustomerdiscountid.ToString()), logLst, "新增", dictcustomer.Customername.ToString(), library.Finalprice.ToString(), modulename);
                    CacheHelper.RemoveAllCache("daan.SelectDictcustomertestdiscountresult");
                }
                catch (Exception ex)
                {
                    nflag = 0;
                    throw new Exception(ex.Message);
                }
            }
            else//保存
            {
                try
                {
                    Dictcustomertestdiscount dictcustomer = GetDictcustomerdiscountById(Convert.ToDouble(library.Dictcustomerdiscountid));
                    nflag = update("Dict.UpdateDictcustomertestdiscount", library);
                    List <LogInfo> logLst             = getLogInfo <Dictcustomertestdiscount>(dictcustomer, library);
                    Dictcustomer   dictcustomerUpdate = new DictCustomerService().GetDictCustomerById(Convert.ToDouble(library.Dictcustomerid));
                    AddMaintenanceLog("Dictcustomertestdiscount", int.Parse(library.Dictcustomerdiscountid.ToString()), logLst, "修改", dictcustomerUpdate.Customername.ToString(), library.Finalprice.ToString(), modulename);
                    CacheHelper.RemoveAllCache("daan.SelectDictcustomertestdiscountresult");
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
            return(nflag > 0);
        }
        public bool AuditDictcustomerdiscounted(string ids, string dictcustomerid, string active, double?auditby)
        {
            int nflag = 0;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("ids", ids);
                ht.Add("Active", active);
                ht.Add("AuditBy", auditby);
                ht.Add("AuditDate", DateTime.Now);
                nflag = update("Dict.AuditDictcustomerdiscounted", ht);
                string oldActice = string.Empty;
                if (active == "0")
                {
                    oldActice = "1";
                }
                else if (active == "1")
                {
                    oldActice = "0";
                }
                //添加基础资料修改日志
                string[] arr = ids.Split(new char[] { ',' });
                foreach (string id in arr)
                {
                    Dictcustomerdiscounted dictcustomerNew = GetDictcustomerdiscountedById(Convert.ToDouble(id));
                    Dictcustomerdiscounted dictcustomerOld = GetDictcustomerdiscountedById(Convert.ToDouble(id));
                    dictcustomerOld.Active = oldActice;
                    Dictcustomer   dictcustomer = new DictCustomerService().GetDictCustomerById(Convert.ToDouble(dictcustomerid));
                    List <LogInfo> logLst       = getLogInfo <Dictcustomerdiscounted>(dictcustomerOld, dictcustomerNew);
                    AddMaintenanceLog("Dictcustomerdiscounted", int.Parse(id), logLst, "审核", dictcustomer.Customername.ToString(), "", modulename);
                }
                CacheHelper.RemoveAllCache("daan.SelectDictcustomerdiscountedresult");
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(nflag > 0);
        }