Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
0
        public override void Delete(object obj)
        {
            BranchTypeInfoDTO oSupplierInfoDTO = (BranchTypeInfoDTO)obj;

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

            String sql = "Delete  BranchTypeInfo where BT_PK=@BT_PK";

            SqlCommand objCmdDelete = sqlConn.CreateCommand();

            objCmdDelete.CommandText = sql;

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

                objCmdDelete.Parameters["@BT_PK"].Value = (Guid)oSupplierInfoDTO.PrimaryKey;

                sqlConn.Open();
                objCmdDelete.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objCmdDelete.Dispose();
                objCmdDelete.Cancel();
                sqlConn.Dispose();
                sqlConn.Close();
            }
        }
Exemplo n.º 3
0
        private void getPKCode(BranchTypeInfoDTO obj)
        {
            SqlConnection sqlConn   = new SqlConnection(ConfigurationManager.ConnectionStrings["DPOSConnectionString"].ToString());
            string        strPKCode = null;
            int           PKSL      = 0;

            string sqlSelect = "Select isnull(Max(BT_Code),0)+1 From BranchTypeInfo";

            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();
            }

            strPKCode   = PKSL.ToString("0");
            obj.BT_Code = strPKCode;
            //return strPKCode;
        }
Exemplo n.º 4
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (this.lblErrorMessage.Text.Length != 0)
        {
            this.lblErrorMessage.Text = "";
        }

        if (this.txtBT_Name.Text.Length == 0)
        {
            this.lblErrorMessage.Text = "Branch type name field can not be blank.";
            this.txtBT_Name.Focus();
            return;
        }

        BranchTypeInfoDTO btdto = Populate();

        try
        {
            Facade            facade            = Facade.GetInstance();
            IBranchTypeInfoBL oBranchTypeInfoBL = facade.createBranchTypeBL();
            oBranchTypeInfoBL.addNewBranchTypeRecord(btdto);
            this.lblErrorMessage.Text = "Data Save Successfully.";
        }
        catch (Exception Exp)
        {
            lblErrorMessage.Text = cls.ErrorString(Exp);
        }
        GridView1.DataBind();
        ControlState_Refresh();
    }
Exemplo n.º 5
0
    protected void GridView1_RowEditing(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "Edit")
            {
                BranchTypeInfoDTO oBranchTypeInfoDTO = new BranchTypeInfoDTO();

                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row   = this.GridView1.Rows[index];

                this.txtBT_Name.Text = Server.HtmlDecode(row.Cells[2].Text);

                //this.Text = Server.HtmlDecode(row.Cells[].Text);
                DataKey dk = this.GridView1.DataKeys[index];
                this.txtBT_PK.Value = dk.Value.ToString();

                Facade facade = Facade.GetInstance();
                oBranchTypeInfoDTO = facade.getBranchTypeInfo((Guid)TypeDescriptor.GetConverter(oBranchTypeInfoDTO.PrimaryKey).ConvertFromString(this.txtBT_PK.Value));

                this.txtBT_Code.Text = oBranchTypeInfoDTO.BT_Code;
                this.txtBT_Name.Text = oBranchTypeInfoDTO.BT_Name;
                this.btnAdd.Text     = "Update";
                this.txtBT_Name.Focus();
            }
        }
        catch (Exception Exp)
        {
            lblErrorMessage.Text = cls.ErrorString(Exp);
        }
    }
Exemplo n.º 6
0
    protected void GridView1_RowEditing(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "Edit")
            {
                BranchInfoDTO odto = new BranchInfoDTO();

                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row   = GridView1.Rows[index];

                DataKey dk = GridView1.DataKeys[index];
                this.txtBR_PK.Value = dk.Value.ToString();

                Facade facade = Facade.GetInstance();
                odto = facade.getBranchInfoDTO((Guid)TypeDescriptor.GetConverter(odto.PrimaryKey).ConvertFromString(this.txtBR_PK.Value));

                this.txtBranchCode.Text = odto.BranchCode;

                BranchTypeInfoDTO btDto = new BranchTypeInfoDTO();
                btDto = facade.getBranchTypeInfo((Guid)odto.BT_PK);
                if (btDto.PrimaryKey.ToString() == "00000000-0000-0000-0000-000000000000")
                {
                    this.ddlBranchType.SelectedValue = "";
                }
                else
                {
                    this.ddlBranchType.SelectedValue = btDto.PrimaryKey.ToString();
                }

                this.txtBranchName.Text         = odto.BranchName;
                this.txtContactPerson.Text      = odto.ContactPerson;
                this.txtContactPersonPhone.Text = odto.ContactPersonPhone;
                this.txtBranchPrefix.Text       = odto.BranchPrefix;
                this.txtBranchAddress.Text      = odto.BranchAddress;
                this.txtTelephone1.Text         = odto.Telephone1;
                this.txtTelephone2.Text         = odto.Telephone2;
                this.txtTelephone3.Text         = odto.Telephone3;
                this.txtFax.Text             = odto.Fax;
                this.txtEMail.Text           = odto.EMail;
                this.txtCashInSafeLimit.Text = odto.CashInSafeLimit.ToString();
                this.btnAdd.Text             = "Update";
                this.txtBranchName.Focus();

                //this.Text = Server.HtmlDecode(row.Cells[].Text);
            }
        }
        catch (Exception Exp)
        {
            lblErrorMessage.Text = cls.ErrorString(Exp);
        }
    }
Exemplo n.º 7
0
        public BranchTypeInfoDTO findByPKDTO(Guid pk)
        {
            BranchTypeInfoDTO oBranchTypeInfoDTO = new BranchTypeInfoDTO();
            //oBranchTypeInfoDTO.PrimaryKey = pk;

            string sqlSelect = "Select BT_PK,BT_Code,BT_Name,EntryBy,EntryDate From BranchTypeInfo where BT_PK=@BT_PK";

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

            SqlCommand objCmd = sqlConn.CreateCommand();

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


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

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

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

                while (thisReader.Read())
                {
                    oBranchTypeInfoDTO = populate(thisReader);
                }

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

            finally
            {
                objCmd.Dispose();
                objCmd.Cancel();
                sqlConn.Dispose();
                sqlConn.Close();
            }
            return(oBranchTypeInfoDTO);
        }
Exemplo n.º 8
0
        public BranchTypeInfoDTO populate(SqlDataReader reader)
        {
            try
            {
                BranchTypeInfoDTO dto = new BranchTypeInfoDTO();

                dto.PrimaryKey = (Guid)reader["BT_PK"];
                dto.BT_Code    = (string)reader["BT_Code"];
                dto.BT_Name    = (string)reader["BT_Name"];
                dto.EntryBy    = (string)reader["EntryBy"];
                dto.EntryDate  = (DateTime)reader["EntryDate"];

                return(dto);
            }
            catch (Exception Exp)
            {
                throw Exp;
            }
        }
Exemplo n.º 9
0
        public List <BranchTypeInfoDTO> getBranchTypeInfoData()
        {
            string sqlSelect = "Select BT_PK,BT_Code,BT_Name,EntryBy,EntryDate From BranchTypeInfo order by BT_Code";

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

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

            SqlCommand objCmd = sqlConn.CreateCommand();

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

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

                while (thisReader.Read())
                {
                    BranchTypeInfoDTO oBranchTypeInfoDTO = populate(thisReader);
                    oArrayList.Add(oBranchTypeInfoDTO);
                }

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

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

            return(oArrayList);
        }
Exemplo n.º 10
0
    private BranchTypeInfoDTO Populate()
    {
        try
        {
            BranchTypeInfoDTO dto = new BranchTypeInfoDTO();

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


            dto.BT_Code   = this.txtBT_Code.Text;
            dto.BT_Name   = this.txtBT_Name.Text;
            dto.EntryBy   = Constants.DEFULT_USER;
            dto.EntryDate = DateTime.Today;

            return(dto);
        }
        catch (Exception Exp)
        {
            throw Exp;
        }
    }
Exemplo n.º 11
0
        public override void Save(object obj)
        {
            BranchTypeInfoDTO oBranchTypeInfoDTO = (BranchTypeInfoDTO)obj;

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

            if (oBranchTypeInfoDTO.PrimaryKey.ToString() == "00000000-0000-0000-0000-000000000000")
            {
                //string strset = getPKCode(oProductCategoryInfoDTO);
                String sql = "Insert Into BranchTypeInfo(BT_Code,BT_Name,EntryBy,EntryDate) values(@BT_Code,@BT_Name,@EntryBy,@EntryDate)";


                try
                {
                    getPKCode(oBranchTypeInfoDTO);

                    objCmd.CommandText = sql;

                    objCmd.Parameters.Add(new SqlParameter("@BT_Code", SqlDbType.VarChar, 1));
                    objCmd.Parameters.Add(new SqlParameter("@BT_Name", SqlDbType.VarChar, 50));
                    objCmd.Parameters.Add(new SqlParameter("@EntryBy", SqlDbType.VarChar, 5));
                    objCmd.Parameters.Add(new SqlParameter("@EntryDate", SqlDbType.DateTime));

                    objCmd.Parameters["@BT_Code"].Value   = Convert.ToString(oBranchTypeInfoDTO.BT_Code);
                    objCmd.Parameters["@BT_Name"].Value   = Convert.ToString(oBranchTypeInfoDTO.BT_Name);
                    objCmd.Parameters["@EntryBy"].Value   = Convert.ToString(oBranchTypeInfoDTO.EntryBy);
                    objCmd.Parameters["@EntryDate"].Value = Convert.ToDateTime(oBranchTypeInfoDTO.EntryDate);

                    sqlConn.Open();
                    objCmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    objCmd.Dispose();
                    objCmd.Cancel();
                    sqlConn.Close();
                    sqlConn.Dispose();
                }
            }
            else
            {
                String sql = "Update  BranchTypeInfo set BT_Name=@BT_Name,EntryBy=@EntryBy,EntryDate=@EntryDate where BT_PK=@BT_PK";


                try
                {
                    objCmd.CommandText = sql;

                    objCmd.Parameters.Add(new SqlParameter("@BT_PK", SqlDbType.UniqueIdentifier, 16));
                    objCmd.Parameters.Add(new SqlParameter("@BT_Name", SqlDbType.VarChar, 50));
                    objCmd.Parameters.Add(new SqlParameter("@EntryBy", SqlDbType.VarChar, 5));
                    objCmd.Parameters.Add(new SqlParameter("@EntryDate", SqlDbType.DateTime));

                    objCmd.Parameters["@BT_PK"].Value     = (Guid)oBranchTypeInfoDTO.PrimaryKey;
                    objCmd.Parameters["@BT_Name"].Value   = Convert.ToString(oBranchTypeInfoDTO.BT_Name);
                    objCmd.Parameters["@EntryBy"].Value   = Convert.ToString(oBranchTypeInfoDTO.EntryBy);
                    objCmd.Parameters["@EntryDate"].Value = Convert.ToDateTime(oBranchTypeInfoDTO.EntryDate);

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