Easy_DataAccess ottieniConnessioneNuovoEsercizio(DataAccess Conn, int newEsercizio) { if (!DatiValidi(Conn, newEsercizio)) { return(null); } DateTime newDate = new DateTime(newEsercizio, 12, 31); if (!CambioDataConsentita(Conn, newDate)) { MessageBox.Show("L'utente non ha diritto ad agire nell'esercizio " + newEsercizio, "Errore"); return(null); } Easy_DataAccess newConn = (Easy_DataAccess)Conn.Duplicate(); newConn.SetSys("esercizio", newEsercizio); newConn.SetSys("datacontabile", newDate); newConn.RecalcUserEnvironment(Conn.GetSys("idflowchart"), Conn.GetSys("ndetail")); newConn.ReadAllGroupOperations(); return(newConn); }
protected void btnok_Click(object sender, EventArgs e) { Easy_DataAccess Conn = GetVars.GetUserConn(Page); bool err = false; string idcustomuser = Conn.GetSys("idcustomuser") as string; object idflowchart = cmbruolo.SelectedValue; object ndetail = Conn.GetSys("ndetail"); object currdate = Conn.GetSys("datacontabile"); string sel = cmbruolo.SelectedValue; if (sel == "" || sel == null) { return; } if (sel.IndexOf("§") < 0) { return; } string [] ss = sel.Split('§'); ndetail = CfgFn.GetNoNullInt32(ss[1]); idflowchart = ss[0]; string filter = QHS.AppAnd(QHS.CmpEq("idcustomuser", idcustomuser), QHS.CmpEq("idflowchart", idflowchart), QHS.CmpEq("ndetail", ndetail)); object title = Conn.DO_READ_VALUE("flowchartuser", filter, "title"); if (title == DBNull.Value) { title = Conn.DO_READ_VALUE("flowchart", QHS.CmpEq("idflowchart", idflowchart), "title"); } Conn.RecalcUserEnvironment(idflowchart, ndetail); Conn.ReadAllGroupOperations(); Session["SavedFlowChart"] = null; if (title != null) { Session["SavedFlowChart"] = title; } Response.Redirect("IndiceReport.aspx"); }