Пример #1
0
        protected void uiGridViewShipping_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataRowView objData = (DataRowView)e.Row.DataItem;
                SeaPorts From = new SeaPorts();
                SeaPorts To = new SeaPorts();
                Companies Comp = new Companies();
                From.LoadByPrimaryKey(Convert.ToInt32(objData["FromSeaPortID"].ToString()));
                Label temp = (Label)e.Row.FindControl("uiLabelFromName");
                temp.Text = From.EnName;

                To.LoadByPrimaryKey(Convert.ToInt32(objData["ToSeaPortID"].ToString()));
                Label temp2 = (Label)e.Row.FindControl("uiLabelToName");
                temp2.Text = To.EnName;

                Comp.LoadByPrimaryKey(Convert.ToInt32(objData["CompanyID"].ToString()));
                Label temp3 = (Label)e.Row.FindControl("uiLabelCompanyName");
                temp3.Text = Comp.ArName;
            }
        }
Пример #2
0
        protected void uiGridViewSeaPorts_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditSeaPort")
            {
                SeaPorts objData = new SeaPorts();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                uiTextBoxEnName.Text = objData.EnName;
                uiTextBoxArName.Text = objData.ArName;
                uiTextBoxCode.Text = objData.SeaPortCode;

                uiPanelViewSeaPorts.Visible = false;
                uiPanelEdit.Visible = true;
                CurrentSeaPort = objData;
            }
            else if (e.CommandName == "DeleteSeaPort")
            {
                SeaPorts objData = new SeaPorts();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                objData.MarkAsDeleted();
                objData.Save();
                CurrentSeaPort = null;
                BindData();
            }
        }