1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
|
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Security;
using BusinessClass.User;
using BusinessClass.FT;
using TDBDate6;
namespace Rindra
{
/// <summary>
/// Summary description for CréationDUneFicheDeTravail.
/// </summary>
public class CréationDUneFicheDeTravail : System.Web.UI.Page
{
protected System.Web.UI.WebControls.HyperLink VueDEnsemble;
protected System.Web.UI.WebControls.HyperLink ResumeProjet;
protected System.Web.UI.WebControls.HyperLink TBIncHeb;
protected System.Web.UI.WebControls.HyperLink AvctIndiv;
protected System.Web.UI.WebControls.HyperLink RapportDAvcmntProjetEC;
protected System.Web.UI.WebControls.HyperLink RecapRessource;
protected System.Web.UI.WebControls.HyperLink RecapProjet;
protected System.Web.UI.WebControls.HyperLink CRRessource;
protected System.Web.UI.WebControls.HyperLink CRSemaine;
protected System.Web.UI.WebControls.HyperLink FTetRealisations;
protected System.Web.UI.HtmlControls.HtmlTableCell TD1;
protected System.Web.UI.HtmlControls.HtmlTableCell TD2;
protected System.Web.UI.HtmlControls.HtmlGenericControl P1;
protected System.Web.UI.HtmlControls.HtmlGenericControl P2;
protected System.Web.UI.HtmlControls.HtmlGenericControl P3;
protected System.Web.UI.HtmlControls.HtmlGenericControl P4;
protected System.Web.UI.HtmlControls.HtmlGenericControl P5;
protected System.Web.UI.HtmlControls.HtmlGenericControl P6;
protected System.Web.UI.WebControls.Button BtnDeconnexion;
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected System.Web.UI.WebControls.CheckBox Validé;
protected System.Web.UI.WebControls.DropDownList FTEtat;
protected System.Web.UI.WebControls.Label RefFT;
protected System.Web.UI.WebControls.Label FTProjet;
protected System.Web.UI.WebControls.Label FtSP;
protected System.Web.UI.WebControls.Label FTResponsable;
protected System.Web.UI.WebControls.Label FTTacheNom;
protected System.Web.UI.WebControls.Label FTRessource;
protected System.Web.UI.WebControls.Label DateDebutPrevue;
protected System.Web.UI.WebControls.Label DateFinPrevue;
protected System.Web.UI.WebControls.Button Button3;
protected System.Web.UI.WebControls.TextBox txtFTHDRDFR;
protected System.Web.UI.WebControls.DataGrid dataGrid1;
protected System.Web.UI.WebControls.DropDownList cmbunite;
protected System.Web.UI.WebControls.Label Label1;
DataSet MTds=new DataSet();
FTRAV_DTLMethod ftdtl=new FTRAV_DTLMethod();
protected System.Web.UI.WebControls.Label totaldeh;
protected System.Web.UI.WebControls.Label totaldej;
protected System.Web.UI.WebControls.Label pourcentage;
protected System.Web.UI.WebControls.Label pourcentage2;
protected System.Web.UI.WebControls.Label totaldrh;
protected System.Web.UI.WebControls.Label totaldrj;
protected System.Web.UI.WebControls.Label totaldch;
protected System.Web.UI.WebControls.Label totaldcj;
public FTRAV_HDR ftnew=new FTRAV_HDR();
public FTRAV_HDR ft=new FTRAV_HDR();
protected System.Web.UI.WebControls.LinkButton LinkButton1;
FTRAV_HDRMethod ftmethod=new FTRAV_HDRMethod();
DataTable dt;
DataView dv;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label error;
protected System.Web.UI.WebControls.TextBox txtHDRDDR;
FTRAV_DTL mtft=new FTRAV_DTL();
private void Page_Load(object sender, System.EventArgs e)
{
int numerotache,numsp;
numerotache=Convert.ToInt32(Request.Params["task_id"].ToString());
string nomtache;
nomtache=Request.Params["tasknom"];
numsp=Convert.ToInt32(Request.Params["sp_id"].ToString());
string projnom;
projnom=Request.Params["proj_nom"];
string spnom;
spnom=Request.Params["sp_nom"];
string resource;
resource=Request.Params["rs_nom"];
string responsable;
responsable=Request.Params["resp"];
DateTime startdate;
startdate=Convert.ToDateTime(Request.Params["startdate"].ToString());
DateTime enddate;
enddate=Convert.ToDateTime(Request.Params["enddate"].ToString());
if(!Page.IsPostBack)
{
//la méthode dont la valeur de retour est irrecuperable
ftnew=ftmethod.add(numerotache, nomtache, numsp, projnom,spnom,responsable, resource,startdate, enddate);
Session["ft"]=ftnew;
}
ft=(FTRAV_HDR)Session["ft"];
//datagrid
MTds=ftdtl.loadFTDTL(ft.FT_HDR_ID);
DataTable dt=new DataTable();
dt=MTds.Tables[0];
if(!Page.IsPostBack)
{
BindGrid();
}
//unite
UniteMethod umethod=new UniteMethod();
DataSet Uds=new DataSet();
if(!Page.IsPostBack)
{
Uds=umethod.loadUnite();
this.cmbunite.DataSource=Uds.Tables[0];
this.cmbunite.DataValueField=Uds.Tables[0].Columns["unite_code"].ToString();
this.cmbunite.DataTextField=Uds.Tables[0].Columns["unite_libelle"].ToString();
this.cmbunite.DataBind();
this.cmbunite.SelectedValue=ft.Unite_Code;
}
//total duree estimee
double de;
de=ftdtl.calculsommede(ft.FT_HDR_ID);
//total duree reelle
double dr;
dr=ftdtl.calculsommedr(ft.FT_HDR_ID);
//total duree correction
double dc;
dc=ftdtl.calculsommedc(ft.FT_HDR_ID);
//conversion et écriture
if(ft.Unite_Code=="1")
{
this.totaldej.Text=de.ToString();
this.totaldeh.Text=umethod.convertJourToHour(de).ToString();
this.totaldrj.Text=dr.ToString();
this.totaldrh.Text=umethod.convertJourToHour(dr).ToString();
this.totaldcj.Text=dc.ToString();
this.totaldch.Text=umethod.convertJourToHour(dc).ToString();
}
else if(ft.Unite_Code=="2")
{
this.totaldej.Text=umethod.convertMnToHour(umethod.convertHourToJour(de)).ToString();
this.totaldeh.Text=umethod.convertHourToJour(de).ToString();
this.totaldrj.Text=umethod.convertMnToHour(umethod.convertHourToJour(dr)).ToString();
this.totaldrh.Text=umethod.convertHourToJour(dr).ToString();
this.totaldcj.Text=umethod.convertMnToHour(umethod.convertHourToJour(dc)).ToString();
this.totaldch.Text=umethod.convertHourToJour(dc).ToString();
}
else if(ft.Unite_Code=="3")
{
this.totaldej.Text=umethod.convertHourToJour(de).ToString();
this.totaldeh.Text=umethod.convertHourToJour(de).ToString();
this.totaldrj.Text=umethod.convertHourToJour(dr).ToString();
this.totaldrh.Text=umethod.convertHourToJour(dr).ToString();
this.totaldcj.Text=umethod.convertHourToJour(dc).ToString();
this.totaldch.Text=umethod.convertHourToJour(dc).ToString();
}
//numtache et numsp
this.RefFT.Text=ft.FT_HDR_Reference;
this.FtSP.Text=ft.FT_HDR_SP_Code;
this.FTTacheNom.Text=ft.Tache_nom;
this.FTProjet.Text=ft.FT_HDR_Projet_Code;
this.FTResponsable.Text=ft.FT_HDR_Responsable_Projet;
this.FTRessource.Text=ft.Ressource_nom;
this.DateDebutPrevue.Text=ft.FT_HDR_Debut_Prevu.ToString();
this.DateFinPrevue.Text=ft.FT_HDR_Fin_Prevu.ToString();
this.txtHDRDDR.Text=ft.FT_HDR_Debut_Reel.ToString();
this.txtHDRDDR.Text=ft.FT_HDR_Fin_Reel.ToString();
}
public void dataGrid1_Edit(Object sender, DataGridCommandEventArgs e)
{
dataGrid1.EditItemIndex= (int)e.Item.ItemIndex;
BindGrid();
}
public void dataGrid1_Cancel(Object sender, DataGridCommandEventArgs e)
{
dataGrid1.EditItemIndex = -1;
BindGrid();
}
public void dataGrid1_Update(Object sender, DataGridCommandEventArgs e)
{
// For bound columns the edited value is stored in a textbox,
// and the textbox is the 0th element in the column's cell
FTRAV_DTL ftnew=new FTRAV_DTL();
mtft=ftdtl.getftdtl_bynumrow(dataGrid1.EditItemIndex,ft.FT_HDR_ID);
ftnew.FT_DTL_ID=mtft.FT_DTL_ID;
ftnew.FT_HDR_NUMERO =mtft.FT_HDR_NUMERO;
ftnew.FT_DTL_Description =((TextBox)e.Item.FindControl("txtftdtldescription")).Text;
// //type tache
// TypeTacheMethod TTmethod=new TypeTacheMethod();
// DataSet TTds=new DataSet();
// TTds=TTmethod.loadTypeFT();
// typetache1= ((DropDownList)dataGrid1.FindControl("cmbtypetache"));
// typetache1.DataSource=TTds.Tables[0];
// typetache1.DataValueField=TTds.Tables[0].Columns["typtache_code"].ToString();
// typetache1.DataTextField=TTds.Tables[0].Columns["typtache_libelle"].ToString();
// typetache1.DataBind();
ftnew.FT_DTL_Type=((TextBox)e.Item.FindControl("txttype1")).Text;
ftnew.FT_DTL_Duree_estime=Convert.ToDouble(((TextBox)e.Item.FindControl("txtftdtldureeestime")).Text.ToString());
ftnew.FT_DTL_Duree_reelle=Convert.ToDouble(((TextBox)e.Item.FindControl("txtftdtldureereelle")).Text.ToString());
ftnew.FT_DTL_Duree_correction=Convert.ToDouble(((TextBox)e.Item.FindControl("txtftdtldureecorr")).Text.ToString());
if(ftdtl.mAJRow(ftnew,dataGrid1.EditItemIndex,ft.FT_HDR_ID))
{
BindGrid();
}
else
{
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
this.BtnDeconnexion.Click += new System.EventHandler(this.BtnDeconnexion_Click);
this.Button3.Click += new System.EventHandler(this.Button3_Click);
this.dataGrid1.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dataGrid1_ItemCommand);
this.dataGrid1.CancelCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dataGrid1_Cancel);
this.dataGrid1.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dataGrid1_Edit);
this.dataGrid1.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dataGrid1_Update);
this.dataGrid1.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dataGrid1_DeleteCommand);
}
#endregion
private void BtnDeconnexion_Click(object sender, System.EventArgs e)
{
FormsAuthentication.SignOut();
Response.Redirect("Authentification.aspx");
}
public void BindGrid()
{
MTds=ftdtl.loadFTDTL(ft.FT_HDR_ID);
//DataTable dt=new DataTable();
//DataView dv=new DataView(dt);
dt=MTds.Tables[0];
dataGrid1.DataSource= dt;
dataGrid1.DataBind();
}
private void dataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName=="Insert")
{
FTRAV_DTL ftnew=new FTRAV_DTL();
ftnew.FT_HDR_NUMERO=ft.FT_HDR_ID;
ftnew.FT_DTL_Description =((TextBox)e.Item.FindControl("txtdescription")).Text;
ftnew.FT_DTL_Type=((TextBox)e.Item.FindControl("txttype")).Text;
ftnew.FT_DTL_Duree_estime=Convert.ToDouble(((TextBox)e.Item.FindControl("txtdureeestime")).Text.ToString());
ftnew.FT_DTL_Duree_reelle=Convert.ToDouble(((TextBox)e.Item.FindControl("txtdureereelle")).Text.ToString());
ftnew.FT_DTL_Duree_correction=Convert.ToDouble(((TextBox)e.Item.FindControl("txtdureereelle")).Text.ToString());
if(ftdtl.checkValid(ftnew))
{
MTds.Tables[0].Rows.Add(new object[]{ftnew.FT_DTL_ID,ftnew.FT_HDR_NUMERO,ftnew.FT_DTL_Description,ftnew.FT_DTL_Type,ftnew.FT_DTL_Charge_estime,ftnew.FT_DTL_Duree_reelle,ftnew.FT_DTL_Charge_correction,ftnew.FT_DTL_Duree_estime,ftnew.FT_DTL_Duree_reelle,ftnew.FT_DTL_Duree_correction,ftnew.FT_DTL_Avancement});
if(ftdtl.saveData(MTds))
{
BindGrid();
}
dataGrid1.EditItemIndex=-1;
}
else
{
error.Text=ftdtl.oerror;
}
}
}
private void dataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName=="Delete")
{
if(ftdtl.deleteRow(e.Item.ItemIndex,ft.FT_HDR_ID))
{
error.Text="reussi";
BindGrid();
//dataGrid1.EditItemIndex=-1;
}
else
{
error.Text=ftdtl.oerror;
}
}
}
private void btnEnregistrerdate_Click(object sender, System.EventArgs e)
{
}
private void Button3_Click(object sender, System.EventArgs e)
{
ft.FT_HDR_Debut_Reel=Convert.ToDateTime(this.txtHDRDDR.Text.ToString());
ft.FT_HDR_Fin_Reel=Convert.ToDateTime(this.txtFTHDRDFR.Text.ToString());
if(ftmethod.mAJRow(ft,0,ft.FT_HDR_Reference))
{
}
else
{
}
}
}
} |
Partager