Exemple #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.lblErrorMessage.Text.Length != 0)
            {
                this.lblErrorMessage.Text = "";
            }

            BoothInfoDTO dto = populate();

            Facade       facade       = Facade.GetInstance();
            IBoothInfoBL oBoothInfoBL = facade.createBoothInfoBL();
            oBoothInfoBL.addNewBoothRecord(dto);

            this.lblErrorMessage.Text = "Data Save Successfully.";

            this.ddlBranchName.SelectedValue = "";
            this.txtHideFieldPK.Value        = "";
            this.txtCashLimit.Text           = "";
            this.chkBoothStatus.Checked      = true;
            this.btnSave.Text = "Save";
            this.GridView1.DataBind();
        }
        catch (Exception Exp)
        {
            lblErrorMessage.Text = cls.ErrorString(Exp);
        }
    }
Exemple #2
0
    public BoothInfoDTO populate()
    {
        try
        {
            string       strPC_PK;
            BoothInfoDTO dto = new BoothInfoDTO();
            // populate dto


            if (this.txtHideFieldPK.Value != "")
            {
                dto.PrimaryKey = (Guid)TypeDescriptor.GetConverter(dto.PrimaryKey).ConvertFromString(this.txtHideFieldPK.Value);
            }

            Guid nullGuid = Guid.NewGuid();
            nullGuid = (Guid)TypeDescriptor.GetConverter(nullGuid).ConvertFromString("00000000-0000-0000-0000-000000000000");

            strPC_PK           = (string)this.ddlBranchName.SelectedValue;
            dto.BR_PK          = strPC_PK == string.Empty ? nullGuid : (Guid)TypeDescriptor.GetConverter(dto.BR_PK).ConvertFromString(strPC_PK);
            dto.BoothCashLimit = this.txtCashLimit.Text == string.Empty ? 0 : (Decimal)TypeDescriptor.GetConverter(dto.BoothCashLimit).ConvertFromString(this.txtCashLimit.Text);
            dto.BoothStatus    = this.chkBoothStatus.Checked;

            dto.EntryBy   = "Admin";
            dto.EntryDate = DateTime.Now.Date;
            return(dto);
        }
        catch (Exception Exp)
        {
            throw Exp;
        }
    }
Exemple #3
0
    private BoothInfoDTO populate()
    {
        try
        {
            short        intBoothNo = 0;
            BoothInfoDTO dto        = new BoothInfoDTO();
            // populate dto

            Facade facade = Facade.GetInstance();

            // PK keep in local variable
            intBoothNo = Convert.ToInt16(ddlBoothNo.SelectedItem.Text);

            //  Get the Booth Information Corresponding Booth No. and keep Booth Info Domain Object
            dto = facade.getBoothInfoByCodeDTO(intBoothNo);

            // set up the member primary code in local declared Hidden field
            this.txtHideFieldPK.Value = dto.PrimaryKey.ToString();

            dto.EntryBy   = "Admin";
            dto.EntryDate = DateTime.Now.Date;
            return(dto);
        }
        catch (Exception Exp)
        {
            throw Exp;
        }
    }
Exemple #4
0
        public BoothInfoDTO populate_all(SqlDataReader reader)
        {
            try
            {
                BoothInfoDTO      dto                = new BoothInfoDTO();
                BranchInfoDTO     oBranchInfoDTO     = new BranchInfoDTO();
                BranchTypeInfoDTO oBranchTypeInfoDTO = new BranchTypeInfoDTO();

                oBranchTypeInfoDTO.BT_Name     = (string)reader["BType_Name"];
                oBranchInfoDTO.BranchCode      = (string)reader["BranchCode"];
                oBranchInfoDTO.BranchName      = (string)reader["BranchName"];
                oBranchInfoDTO.ContactPerson   = (string)reader["ContactPerson"];
                oBranchInfoDTO.BranchAddress   = (string)reader["BranchAddress"];
                oBranchInfoDTO.Telephone1      = (string)reader["Telephone1"];
                oBranchInfoDTO.Telephone2      = (string)reader["Telephone2"];
                oBranchInfoDTO.Fax             = (string)reader["Fax"];
                oBranchInfoDTO.EMail           = (string)reader["EMail"];
                oBranchInfoDTO.CashInSafeLimit = (decimal)reader["CashInSafeLimit"];
                dto.BoothNo        = (Int16)reader["BoothNo"];
                dto.BoothCashLimit = (decimal)reader["BoothCashLimit"];
                dto.BoothStatus    = (bool)reader["BoothStatus"];
                dto.MachineID      = (string)reader["MachineID"];

                dto.BranchCode = oBranchInfoDTO;
                dto.BranchCode.BranchTypeInfoDTO = oBranchTypeInfoDTO;


                return(dto);
            }
            catch (Exception Exp)
            {
                throw Exp;
            }
        }
Exemple #5
0
        public BoothInfoDTO populate(SqlDataReader reader)
        {
            try
            {
                BoothInfoDTO dto = new BoothInfoDTO();
                dto.PrimaryKey     = (Guid)reader["Bo_PK"];
                dto.BR_PK          = (Guid)reader["BR_PK"];
                dto.BoothNo        = (Int16)reader["BoothNo"];
                dto.BoothCashLimit = (decimal)reader["BoothCashLimit"];
                dto.BoothStatus    = (bool)reader["BoothStatus"];
                if (reader.IsDBNull(5) == true)
                {
                    dto.MachineID = null;
                }
                else
                {
                    dto.MachineID = (string)reader["MachineID"];
                }
                dto.EntryBy   = (string)reader["EntryBy"];
                dto.EntryDate = (DateTime)reader["EntryDate"];

                return(dto);
            }
            catch (Exception Exp)
            {
                throw Exp;
            }
        }
Exemple #6
0
        private void getPKCode(BoothInfoDTO obj)
        {
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["DPOSConnectionString"].ToString());
            int           PKSL    = 0;

            string sqlSelect = "Select isnull(Max(BoothNo),000)+1 From BoothInfo";

            SqlCommand objCmd = sqlConn.CreateCommand();

            objCmd.CommandText = sqlSelect;

            try
            {
                sqlConn.Open();
                PKSL = (int)objCmd.ExecuteScalar();
            }
            catch (Exception Exp)
            {
                throw Exp;
            }
            finally
            {
                objCmd.Dispose();
                objCmd.Cancel();
                sqlConn.Dispose();
                sqlConn.Close();
            }

            obj.BoothNo = PKSL;
        }
Exemple #7
0
        public override void Delete(object obj)
        {
            BoothInfoDTO oBoothInfoDTO = (BoothInfoDTO)obj;

            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["DPOSConnectionString"].ToString());

            String sql = "Delete  BoothInfo where Bo_PK=@Bo_PK";

            SqlCommand objCmdDelete = sqlConn.CreateCommand();

            objCmdDelete.CommandText = sql;

            try
            {
                objCmdDelete.Parameters.Add("@Bo_PK", SqlDbType.UniqueIdentifier, 16);

                objCmdDelete.Parameters["@Bo_PK"].Value = (Guid)oBoothInfoDTO.PrimaryKey;

                sqlConn.Open();
                objCmdDelete.ExecuteNonQuery();
            }
            catch (Exception Exp)
            {
                throw Exp;
            }
            finally
            {
                objCmdDelete.Dispose();
                objCmdDelete.Cancel();
                sqlConn.Dispose();
                sqlConn.Close();
            }
        }
Exemple #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pk"></param>
        /// <returns></returns>
        public BoothInfoDTO findByPK_AllDTO(Guid pk)
        {
            BoothInfoDTO oBoothInfoDTO = new BoothInfoDTO();


            string sqlSelect = "SELECT BranchTypeInfo.BT_Name as 'BType_Name', BranchInfo.BranchCode, " +
                               "BranchInfo.BranchName, BranchInfo.ContactPerson, BranchInfo.BranchAddress, " +
                               " BranchInfo.Telephone1, BranchInfo.Telephone2, BranchInfo.Fax, BranchInfo.EMail," +
                               " BranchInfo.CashInSafeLimit, BoothInfo.BoothNo,  BoothInfo.BoothCashLimit, " +
                               " BoothInfo.BoothStatus, BoothInfo.MachineID, BoothInfo.Bo_PK FROM BranchTypeInfo " +
                               " INNER JOIN  BranchInfo ON BranchTypeInfo.BT_PK = BranchInfo.BT_PK INNER JOIN " +
                               "BoothInfo ON BranchInfo.BR_PK = BoothInfo.BR_PK WHERE    BoothInfo.Bo_PK = @Bo_PK ";

            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["DPOSConnectionString"].ToString());

            SqlCommand objCmd = sqlConn.CreateCommand();

            objCmd.CommandText = sqlSelect;
            objCmd.Connection  = sqlConn;



            try
            {
                objCmd.Parameters.Add("@Bo_PK", SqlDbType.UniqueIdentifier, 16);

                objCmd.Parameters["@Bo_PK"].Value = pk;

                sqlConn.Open();
                SqlDataReader thisReader = objCmd.ExecuteReader();

                if (thisReader.Read())
                {
                    oBoothInfoDTO = populate_all(thisReader);
                }

                thisReader.Close();
                thisReader.Dispose();
            }
            catch (Exception Exp)
            {
                throw Exp;
            }

            finally
            {
                objCmd.Dispose();
                objCmd.Cancel();
                sqlConn.Dispose();
                sqlConn.Close();
            }
            return(oBoothInfoDTO);
        }
Exemple #9
0
        /// <summary>
        /// Find Booth Information corresponding Booth Code
        /// </summary>
        /// <param name="BoothCode"></param>
        /// <returns></returns>
        public BoothInfoDTO findBoothInfoByCodeDTO(short BoothCode)
        {
            BoothInfoDTO oBoothInfoDTO = new BoothInfoDTO();


            string sqlSelect = "Select Bo_PK,BR_PK,BoothNo,BoothCashLimit,BoothStatus,MachineID,EntryBy,EntryDate From BoothInfo where BoothNo=@BoothNo";

            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["DPOSConnectionString"].ToString());

            SqlCommand objCmd = sqlConn.CreateCommand();

            objCmd.CommandText = sqlSelect;
            objCmd.Connection  = sqlConn;



            try
            {
                objCmd.Parameters.Add("@BoothNo", SqlDbType.SmallInt, 2);

                objCmd.Parameters["@BoothNo"].Value = BoothCode;

                sqlConn.Open();
                SqlDataReader thisReader = objCmd.ExecuteReader();

                if (thisReader.Read())
                {
                    oBoothInfoDTO = populate(thisReader);
                }

                thisReader.Close();
                thisReader.Dispose();
            }
            catch (Exception Exp)
            {
                throw Exp;
            }

            finally
            {
                objCmd.Dispose();
                objCmd.Cancel();
                sqlConn.Dispose();
                sqlConn.Close();
            }
            return(oBoothInfoDTO);
        }
Exemple #10
0
        public List <BoothInfoDTO> getBoothInfoData()
        {
            string sqlSelect = "Select Bo_PK,BR_PK,BoothNo,BoothCashLimit,BoothStatus,MachineID,EntryBy,EntryDate From BoothInfo order by BoothNo DESC";

            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["DPOSConnectionString"].ToString());

            List <BoothInfoDTO> oArrayList = new List <BoothInfoDTO>();

            SqlCommand objCmd = sqlConn.CreateCommand();

            objCmd.CommandText = sqlSelect;
            objCmd.Connection  = sqlConn;

            try
            {
                sqlConn.Open();
                SqlDataReader thisReader = objCmd.ExecuteReader();

                while (thisReader.Read())
                {
                    BoothInfoDTO oBoothInfoDTO = populate(thisReader);
                    oArrayList.Add(oBoothInfoDTO);
                }

                thisReader.Close();
                thisReader.Dispose();
            }
            catch (Exception Exp)
            {
                throw Exp;
            }

            finally
            {
                objCmd.Dispose();
                objCmd.Cancel();
                sqlConn.Dispose();
                sqlConn.Close();
            }

            return(oArrayList);
        }
Exemple #11
0
    protected void GridView1_RowEdting(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "Edit")
            {
                BoothInfoDTO oBoothInfoDTO = new BoothInfoDTO();

                int index = Convert.ToInt32(e.CommandArgument);

                GridViewRow row = GridView1.Rows[index];

                DataKey xx = this.GridView1.DataKeys[index];
                this.txtHideFieldPK.Value = xx.Value.ToString();

                Facade facade = Facade.GetInstance();
                oBoothInfoDTO               = facade.getBoothInfoDTO((Guid)TypeDescriptor.GetConverter(oBoothInfoDTO.PrimaryKey).ConvertFromString(this.txtHideFieldPK.Value));
                this.txtCashLimit.Text      = oBoothInfoDTO.BoothCashLimit.ToString();
                this.chkBoothStatus.Checked = oBoothInfoDTO.BoothStatus;

                BranchInfoDTO bDto = new BranchInfoDTO();
                bDto = facade.getBranchInfoDTO((Guid)oBoothInfoDTO.BR_PK);
                if (bDto.PrimaryKey.ToString() == "00000000-0000-0000-0000-000000000000")
                {
                    this.ddlBranchName.SelectedValue = "";
                }
                else
                {
                    this.ddlBranchName.SelectedValue = bDto.PrimaryKey.ToString();
                }
                this.lblErrorMessage.Text = "";
                this.btnSave.Text         = "Update";
            }
        }
        catch (Exception Exp)
        {
            lblErrorMessage.Text = cls.ErrorString(Exp);
        }
    }
Exemple #12
0
    protected void btnReport_Click(object sender, EventArgs e)
    {
        this.lblErrorMessage.Text = "";
        if (this.txtFromDate.Text.Trim() == "")
        {
            this.lblErrorMessage.Text = "Please Insert Start Date.";
            return;
        }
        else if (this.txtToDate.Text.Trim() == "")
        {
            this.lblErrorMessage.Text = "Please Insert End Date.";
            return;
        }

        else if (this.RbSpecificProduct.Checked == true &&
                 this.DDLProductName.Text == "00000000-0000-0000-0000-000000000000")
        {
            this.lblErrorMessage.Text = "Please Select Product Name.";
            return;
        }

        else if (this.RbSpecificCategory.Checked == true &&
                 this.DDLCategory.Text == "00000000-0000-0000-0000-000000000000")
        {
            this.lblErrorMessage.Text = "Please Select Category Name.";
            return;
        }
        else if (this.RbSpecificSubCategory.Checked == true &&
                 this.DDLSubCategory.Text == "00000000-0000-0000-0000-000000000000")
        {
            this.lblErrorMessage.Text = "Please Select Sub Category Name.";
            return;
        }
        else if (this.RbSpecificBrand.Checked == true &&
                 this.DDLBrand.Text == "00000000-0000-0000-0000-000000000000")
        {
            this.lblErrorMessage.Text = "Please Select Brand Name.";
            return;
        }
        else
        {
            this.lblErrorMessage.Text = "";
        }

        ReportStockRegisterInfo oReportStocknfo = new ReportStockRegisterInfo();

        try
        {
            DateTime dtFrom, dtTo;
            string   strReportCaption, crPath, strBranchName, strBrnachType, strBranchAddress, strPhone, strEmail, strPrintedBy, DemandStartDate, DemandEndDate;
            strReportCaption = "";
            crPath           = "";
            strBranchName    = "";
            strBrnachType    = "";
            strBranchAddress = "";
            strPhone         = "";
            strEmail         = "";
            strPrintedBy     = "Admin";
            DemandStartDate  = this.txtFromDate.Text;
            DemandEndDate    = this.txtToDate.Text;

            dtFrom = Convert.ToDateTime(this.txtFromDate.Text);
            dtTo   = Convert.ToDateTime(this.txtToDate.Text);
            Guid productCategoryPk    = Guid.NewGuid();
            Guid productSubCategoryPk = Guid.NewGuid();
            Guid productBrandPk       = Guid.NewGuid();
            Guid productPk            = Guid.NewGuid();

            productCategoryPk    = (Guid)TypeDescriptor.GetConverter(productCategoryPk).ConvertFromString(this.DDLCategory.SelectedValue);
            productSubCategoryPk = (Guid)TypeDescriptor.GetConverter(productSubCategoryPk).ConvertFromString(this.DDLSubCategory.SelectedValue);
            productBrandPk       = (Guid)TypeDescriptor.GetConverter(productBrandPk).ConvertFromString(this.DDLBrand.SelectedValue);
            productPk            = (Guid)TypeDescriptor.GetConverter(productPk).ConvertFromString(this.DDLProductName.SelectedValue);


            DataSet rptDS = new DataSet();
            rptDS = oReportStocknfo.GetStockInfo(dtFrom, dtTo, productCategoryPk, productSubCategoryPk, productBrandPk, productPk);

            // Retrieving data in cookies
            if (Request.Cookies["DPOS"] != null)
            {
                string strBoothID = "";

                if (Request.Cookies["DPOS"]["BoothNo"] != null)
                {
                    strBoothID = Request.Cookies["DPOS"]["BoothNo"];

                    Guid         BoothID = Guid.NewGuid();
                    BoothInfoDTO dto     = new BoothInfoDTO();
                    // populate dto

                    Facade facade = Facade.GetInstance();

                    // PK keep in local variable
                    BoothID = (Guid)TypeDescriptor.GetConverter(BoothID).ConvertFromString(strBoothID);

                    //  Get the Booth Information Corresponding Booth No. and keep Booth Info Domain Object
                    dto = facade.getBoothInfo_AllDTO(BoothID);

                    strBranchName    = dto.BranchCode.BranchName;
                    strBrnachType    = dto.BranchCode.BranchTypeInfoDTO.BT_Name;
                    strBranchAddress = dto.BranchCode.BranchAddress;
                    strPhone         = dto.BranchCode.Telephone1 + "," + dto.BranchCode.Telephone2 + "," + dto.BranchCode.Telephone3;
                    strEmail         = dto.BranchCode.EMail;
                }
            }

            if (rbWithAmount.Checked == true && rbWithoutAmount.Checked == false)
            {
                strReportCaption = lblWithAmount.Text;
                crPath           = "CrysStockRegister.rpt";
            }

            if (rbWithAmount.Checked == false && rbWithoutAmount.Checked == true)
            {
                strReportCaption = lblWithoutAmount.Text;
                crPath           = "CrysStockRegisterWithoutAmount.rpt";
            }

            string reportPath = Server.MapPath(crPath);
            oReportDocument.Load(reportPath);
            oReportDocument.SetDataSource(rptDS.Tables[0]);
            oReportDocument.SetParameterValue("@ReportCaption", strReportCaption);
            oReportDocument.SetParameterValue("@DemandStartDate", DemandStartDate);
            oReportDocument.SetParameterValue("@DemandEndDate", DemandEndDate);
            oReportDocument.SetParameterValue("@BranchName", strBranchName);
            oReportDocument.SetParameterValue("@BranchType", strBrnachType);
            oReportDocument.SetParameterValue("@BranchAddress", strBranchAddress);
            oReportDocument.SetParameterValue("@BranchPhone", strPhone);
            oReportDocument.SetParameterValue("@BranchEmail", strEmail);
            oReportDocument.SetParameterValue("@PrintedBy", strPrintedBy);
            CommonViewer.CRReportDefinition = oReportDocument;

            Response.Redirect("~/Report/AllCrystalReportViewer/ReportViewer.aspx");
        }
        catch (Exception exp)
        {
            throw exp;
        }
    }
Exemple #13
0
    protected void btnReport_Click(object sender, EventArgs e)
    {
        ReportSetupInfo oReportSetupInfo = new ReportSetupInfo();
        string          crPath, strBranchName, strBrnachType, strBranchAddress, strPhone, strEmail, strPrintedBy;

        crPath           = "";
        strBranchName    = "";
        strBrnachType    = "";
        strBranchAddress = "";
        strPhone         = "";
        strEmail         = "";
        strPrintedBy     = "Admin";

        DataSet ds = new DataSet();
        Guid    BranchPk = Guid.NewGuid();

        //BranchPk = (Guid)TypeDescriptor.GetConverter(BranchPk).ConvertFromString(this.DDLBranch.SelectedValue);


        try
        {
            // Retrieving data in cookies
            if (Request.Cookies["DPOS"] != null)
            {
                string strBoothID = "";

                if (Request.Cookies["DPOS"]["BoothNo"] != null)
                {
                    strBoothID = Request.Cookies["DPOS"]["BoothNo"];

                    Guid         BoothID = Guid.NewGuid();
                    BoothInfoDTO dto     = new BoothInfoDTO();
                    // populate dto

                    Facade facade = Facade.GetInstance();

                    // PK keep in local variable
                    BoothID = (Guid)TypeDescriptor.GetConverter(BoothID).ConvertFromString(strBoothID);

                    //  Get the Booth Information Corresponding Booth No. and keep Booth Info Domain Object
                    dto = facade.getBoothInfo_AllDTO(BoothID);

                    strBranchName    = dto.BranchCode.BranchName;
                    strBrnachType    = dto.BranchCode.BranchTypeInfoDTO.BT_Name;
                    strBranchAddress = dto.BranchCode.BranchAddress;
                    strPhone         = dto.BranchCode.Telephone1 + "," + dto.BranchCode.Telephone2 + "," + dto.BranchCode.Telephone3;
                    strEmail         = dto.BranchCode.EMail;
                }
            }
            //else
            //    lblmsg.Text = "call your system admin!";
            //return;
            if (this.RbBranchInformation.Checked == true)
            {
                ds     = oReportSetupInfo.getBranchInfo(1);
                crPath = "CrysBranchInfo.rpt";
            }
            else if (this.RbMemberInformation.Checked == true)
            {
                ds     = oReportSetupInfo.getMemberInfo(2);
                crPath = "CrysMemberInfo.rpt";
            }
            else if (this.RbSupplierInformation.Checked == true)
            {
                ds     = oReportSetupInfo.getSupplierInfo(3);
                crPath = "CrysSupplierInfo.rpt";
            }
            else if (this.RbProductInformation.Checked == true)
            {
                ds     = oReportSetupInfo.getProductInfo(4);
                crPath = "CrysAllProductInfo.rpt";
            }
            else if (this.RbProductCategoryInfo.Checked == true)
            {
                ds     = oReportSetupInfo.getProductCategoryInfo(5);
                crPath = "CrysProductCategoryInfo.rpt";
            }

            else if (this.RbProductSubCategoryInfo.Checked == true)
            {
                ds     = oReportSetupInfo.getProductSubCategoryInfo(6);
                crPath = "CrysProductSubCategoryInfo.rpt";
            }

            else if (this.RbProductUnitInfo.Checked == true)
            {
                ds     = oReportSetupInfo.getProductUnitInfo(7);
                crPath = "CrysProductUnitInfo.rpt";
            }

            else if (this.RbBoothInfo.Checked == true)
            {
                ds     = oReportSetupInfo.getBoothInfo(8);
                crPath = "CrysBoothInfo.rpt";
            }

            else if (this.RbProductSummary.Checked == true)
            {
                ds     = oReportSetupInfo.getProductSummaryInfo(9);
                crPath = "CrysProductSummaryInfo.rpt";
            }

            string reportPath = Server.MapPath(crPath);
            oReportDocument.Load(reportPath);
            oReportDocument.SetDataSource(ds.Tables[0]);

            oReportDocument.SetParameterValue("@PrintedBy", strPrintedBy);
            oReportDocument.SetParameterValue("@BranchName", strBranchName);
            oReportDocument.SetParameterValue("@BranchType", strBrnachType);
            oReportDocument.SetParameterValue("@BranchAddress", strBranchAddress);
            oReportDocument.SetParameterValue("@BranchPhone", strPhone);
            oReportDocument.SetParameterValue("@BranchEmail", strEmail);
            CommonViewer.CRReportDefinition = oReportDocument;

            Response.Redirect("~\\Report\\AllCrystalReportViewer\\ReportViewer.aspx");
        }
        catch (Exception exp)
        {
            throw exp;
        }
    }
Exemple #14
0
    protected void btnBoothReg_Click(object sender, EventArgs e)
    {
        int permanentDay = 0;
        int demoDay      = 0;
        int ExpiresDate  = 0;

        if ((chkPermanent.Checked == false) && (chkDemo.Checked == false))
        {
            this.lblErrorMessage.Text = "You must be select Registration Type!";
            return;
        }
        if ((chkPermanent.Checked == true) && (chkDemo.Checked == true))
        {
            this.lblErrorMessage.Text = "You must be select one registration Type!";
            return;
        }
        if ((chkPermanent.Checked == true) && (chkDemo.Checked == false))
        {
            permanentDay = 356;
        }
        if ((chkPermanent.Checked == false) && (chkDemo.Checked == true))
        {
            if (this.txtBoothExpiresDate.Text == "")
            {
                return;
            }
            demoDay = int.Parse(this.txtBoothExpiresDate.Text);
        }
        if (this.lblErrorMessage.Text.Length != 0)
        {
            this.lblErrorMessage.Text = "";
        }


        BoothInfoDTO dto = populate();

        Facade       facade       = Facade.GetInstance();
        IBoothInfoBL oBoothInfoBL = facade.createBoothInfoBL();

        oBoothInfoBL.addNewBoothRecord(dto);


        // Get values in text field
        string boothNo = this.ddlBoothNo.SelectedValue;

        if (permanentDay != 0)
        {
            ExpiresDate = permanentDay;
        }
        else
        {
            ExpiresDate = demoDay;
        }



        DateTime dt = DateTime.Now;
        TimeSpan ts = new TimeSpan(0, ExpiresDate, 0, 0);

        //Create a custome coookies
        HttpCookie myCookie = new HttpCookie("DPOS");

        //Keep data in cookies
        //myCookie["BoothNo"] = "ONE";
        myCookie["BoothNo"] = boothNo;
        myCookie.Expires    = dt.Add(ts);
        Response.Cookies.Add(myCookie);


        this.lblErrorMessage.Text     = "Booth Registration Successfully.";
        this.ddlBoothNo.SelectedValue = "";
        //this.pnlDay.Visible = false;
        this.txtHideFieldPK.Value = "";
        this.chkPermanent.Checked = false;
        this.chkDemo.Checked      = false;
    }
Exemple #15
0
        public override void Save(object obj)
        {
            BoothInfoDTO oBoothInfoDTO = (BoothInfoDTO)obj;

            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["DPOSConnectionString"].ToString());

            SqlCommand objCmd = sqlConn.CreateCommand();

            if (oBoothInfoDTO.PrimaryKey.ToString() == "00000000-0000-0000-0000-000000000000")
            {
                //string strset = getPKCode(oProductCategoryInfoDTO);
                String sql = "Insert Into BoothInfo(BR_PK,BoothNo,BoothCashLimit,BoothStatus,EntryBy,EntryDate) values(@BR_PK,@BoothNo,@BoothCashLimit,@BoothStatus,@EntryBy,@EntryDate)";


                try
                {
                    getPKCode(oBoothInfoDTO);

                    objCmd.CommandText = sql;

                    objCmd.Parameters.Add(new SqlParameter("@BR_PK", SqlDbType.UniqueIdentifier, 16));
                    objCmd.Parameters.Add(new SqlParameter("@BoothNo", SqlDbType.Int, 2));
                    objCmd.Parameters.Add(new SqlParameter("@BoothCashLimit", SqlDbType.Decimal, 9));
                    objCmd.Parameters.Add(new SqlParameter("@BoothStatus", SqlDbType.Bit, 1));
                    objCmd.Parameters.Add(new SqlParameter("@EntryBy", SqlDbType.VarChar, 5));
                    objCmd.Parameters.Add(new SqlParameter("@EntryDate", SqlDbType.DateTime));

                    objCmd.Parameters["@BR_PK"].Value          = (Guid)oBoothInfoDTO.BR_PK;
                    objCmd.Parameters["@BoothNo"].Value        = Convert.ToInt16(oBoothInfoDTO.BoothNo);
                    objCmd.Parameters["@BoothCashLimit"].Value = Convert.ToDecimal(oBoothInfoDTO.BoothCashLimit);
                    objCmd.Parameters["@BoothStatus"].Value    = Convert.ToBoolean(oBoothInfoDTO.BoothStatus);
                    objCmd.Parameters["@EntryBy"].Value        = Convert.ToString(oBoothInfoDTO.EntryBy);
                    objCmd.Parameters["@EntryDate"].Value      = Convert.ToDateTime(oBoothInfoDTO.EntryDate);

                    sqlConn.Open();
                    objCmd.ExecuteNonQuery();
                }
                catch (Exception Exp)
                {
                    throw Exp;
                }
                finally
                {
                    objCmd.Dispose();
                    objCmd.Cancel();
                    sqlConn.Close();
                    sqlConn.Dispose();
                }
            }
            else
            {
                String sql = "Update  BoothInfo set BR_PK=@BR_PK,BoothCashLimit=@BoothCashLimit,BoothStatus=@BoothStatus,MachineID=@MachineID,EntryBy=@EntryBy,EntryDate=@EntryDate where Bo_PK=@Bo_PK";

                //objCmd = new SqlCommand(sql, getCurrentConnection(), getCurrentTransaction()); ;

                try
                {
                    objCmd.CommandText = sql;

                    objCmd.Parameters.Add(new SqlParameter("@Bo_PK", SqlDbType.UniqueIdentifier, 16));
                    objCmd.Parameters.Add(new SqlParameter("@BR_PK", SqlDbType.UniqueIdentifier, 16));
                    objCmd.Parameters.Add(new SqlParameter("@BoothCashLimit", SqlDbType.Decimal));
                    objCmd.Parameters.Add(new SqlParameter("@BoothStatus", SqlDbType.Bit));
                    objCmd.Parameters.Add(new SqlParameter("@MachineID", SqlDbType.NVarChar, 50));
                    objCmd.Parameters.Add(new SqlParameter("@EntryBy", SqlDbType.VarChar, 5));
                    objCmd.Parameters.Add(new SqlParameter("@EntryDate", SqlDbType.DateTime));

                    objCmd.Parameters["@Bo_PK"].Value          = (Guid)oBoothInfoDTO.PrimaryKey;
                    objCmd.Parameters["@BR_PK"].Value          = (Guid)oBoothInfoDTO.BR_PK;
                    objCmd.Parameters["@BoothCashLimit"].Value = Convert.ToDecimal(oBoothInfoDTO.BoothCashLimit);
                    objCmd.Parameters["@BoothStatus"].Value    = Convert.ToBoolean(oBoothInfoDTO.BoothStatus);
                    //Not Identity MachineId
                    objCmd.Parameters["@MachineID"].Value = Convert.ToString(oBoothInfoDTO.BoothNo);
                    objCmd.Parameters["@EntryBy"].Value   = Convert.ToString(oBoothInfoDTO.EntryBy);
                    objCmd.Parameters["@EntryDate"].Value = Convert.ToDateTime(oBoothInfoDTO.EntryDate);

                    sqlConn.Open();
                    objCmd.ExecuteNonQuery();
                }
                catch (Exception Exp)
                {
                    throw Exp;
                }
                finally
                {
                    objCmd.Dispose();
                    objCmd.Cancel();
                    sqlConn.Dispose();
                    sqlConn.Close();
                }
            }
        }