示例#1
0
        public string db_AddNewSite(string SiteName, string SiteAddress, string SiteHeight, string SiteWidth, string SiteAmount, string SiteImage)
        {
            string output      = null;
            int    site_seq_no = db_GetSeqNo("SITE");

            if (site_seq_no == 0)
            {
                output = Status.ERR;
            }
            else
            {
                site_seq_no = site_seq_no + 1;
                SiteImage   = FileOperations.CopySiteImage(SiteImage, site_seq_no);
                if (CustomValidation.validateString(SiteImage))
                {
                    return("Failure in copying image");
                }
                object[] parameters = { site_seq_no, SiteName, SiteAddress, SiteHeight, SiteWidth, SiteAmount, SiteImage };

                int rowsInserted = dBOpertions.INSERT(queries.addNewSite, parameters);
                if (rowsInserted == 1)
                {
                    string updateOutput = db_updateSeqNo("SITE", site_seq_no);
                    if (updateOutput.Equals(Status.SUCC))
                    {
                        output = Status.SUCC;
                    }
                    else
                    {
                        output = updateOutput;
                    }
                }
                else
                {
                    output = Status.ERR;
                }
            }

            return(output);
        }
示例#2
0
        public string db_MdfySite(SiteModel siteModel, string SiteName, string SiteAddress, string SiteHeight, string SiteWidth, string SiteAmount, string SiteImage)
        {
            string output = null;

            SiteImage = FileOperations.CopySiteImage(SiteImage, siteModel.SiteSeqNum);
            if (CustomValidation.validateString(SiteImage))
            {
                return("Failure in copying image");
            }
            object[] parameters = { SiteName, SiteAddress, SiteHeight, SiteWidth, SiteAmount, SiteImage, siteModel.SiteSeqNum };

            int rowsUpdated = dBOpertions.UPDATE(queries.mdfySite, parameters);

            if (rowsUpdated == 1)
            {
                output = Status.SUCC;
            }
            else
            {
                output = Status.ERR;
            }

            return(output);
        }