Esempio n. 1
0
        public int cloneAds(string _companyName,
            string _address,
            string _email,
            string _phone,
            DateTime _from,
            DateTime _end,
            string _location,
            string _navigateUrl,
            string _description)
        {
            LTDHDataContext DB = new LTDHDataContext(@strPathDB);
            int id = -1;
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    tblAdvertisement record = new tblAdvertisement();
                    record.Company = _companyName;
                    record.Address = _address;
                    record.Email = _email;
                    record.Phone = _phone;
                    record.fromDate = _from;
                    record.toDate = _end;
                    record.Price = 0;
                    record.FilePath = CommonConstants.BLANK;
                    record.Location = _location;
                    record.Code = CommonConstants.ADS_INACTIVE;
                    record.ClickCount = 0;
                    record.NavigateUrl = _navigateUrl;
                    record.FilePath = CommonConstants.BLANK;
                    record.Description = _description;
                    record.Size = CommonConstants.DEFAULT_ADS_IMG_SIZE;
                    record.State = CommonConstants.STATE_UNCHECK;

                    DB.tblAdvertisements.InsertOnSubmit(record);
                    DB.SubmitChanges();

                    ts.Complete();

                    id = record.ID;

                    log.writeLog(DBHelper.strPathLogFile,
                                BaseServices.createMsgByTemplate(CommonConstants.SQL_INSERT_SUCCESSFUL_TEMPLATE,
                                                                    record.ID.ToString(),
                                                                    CommonConstants.SQL_TABLE_ADVERTISEMENT));
                }
            }
            catch (Exception e)
            {
                log.writeLog(DBHelper.strPathLogFile, e.Message
                                                        + CommonConstants.NEWLINE
                                                        + e.Source
                                                        + CommonConstants.NEWLINE
                                                        + e.StackTrace
                                                        + CommonConstants.NEWLINE
                                                        + e.HelpLink);
                return -1;
            }

            return id;
        }
Esempio n. 2
0
 partial void UpdatetblAdvertisement(tblAdvertisement instance);
Esempio n. 3
0
 partial void DeletetblAdvertisement(tblAdvertisement instance);
Esempio n. 4
0
 partial void InserttblAdvertisement(tblAdvertisement instance);